The moVer Posted June 11, 2015 Share Posted June 11, 2015 السلام عليكم شباب انا سويت لوحة تسجيل ابي انه الواحد يسوي بس حسابين وكيف احفظ الحسابين بملف ميتا عشان اقدر اغيرهن متى ما ابي ويا ريت مثال لانه مرة جربت وما ضبط والسلام خير ختام Link to comment
ALw7sH Posted June 11, 2015 Share Posted June 11, 2015 SQL اذا كان قصدك لكل سريال بس حسابين استخدم فنكشنات Link to comment
The moVer Posted June 11, 2015 Author Share Posted June 11, 2015 طيب الاسكيول فهمتها بس الاكس ام ال وبشرط يكون يمديني اغيرها وجزاك الله خيرا Link to comment
#DRAGON!FIRE Posted June 11, 2015 Share Posted June 11, 2015 هذا مثال بسيط وانت طبقه ع كودكـ .. لو في اي شي ما فهمته تفضل اسال : addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS moneySystem ( pSerial, AccountsCount )" ) end ) addEventHandler ( "onPlayerLogin", root, function ( ) local lCheck = executeSQLQuery ( "SELECT AccountsCount FROM moneySystem WHERE pSerial=?", getPlayerSerial ( source ) ) if ( #lCheck <= 0 ) then executeSQLQuery ( "INSERT INTO moneySystem ( pSerial, AccountsCount ) VALUES(?,?)", getPlayerSerial ( source ), 0 ) end end ) addCommandHandler ( "giveMeMoney", function ( player ) local sCheck = executeSQLQuery ( "SELECT AccountsCount FROM moneySystem WHERE pSerial=?", getPlayerSerial ( player ) ) if ( #sCheck > 0 ) then if ( tonumber ( sCheck[1].AccountsCount ) == 2 ) then outputChatBox ( "You already took money for 2 times" ) else givePlayerMoney ( player, 2000 ) executeSQLQuery ( "UPDATE moneySystem SET AccountsCount=? WHERE pSerial=?", tonumber ( sCheck[1].AccountsCount ) + 1, getPlayerSerial ( player ) ) end end end ) Link to comment
The moVer Posted June 11, 2015 Author Share Posted June 11, 2015 addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS Accounts ( playerSerial, playerAccounts )" ) end ) function registerPlayer () local lCheck = executeSQLQuery ( "SELECT AccountsCount FROM Accounts WHERE playerSerial=?", getPlayerSerial ( source ) ) if ( #lCheck <= 2 ) then executeSQLQuery ( "INSERT INTO Accounts ( playerSerial, playerAccounts ) VALUES(?,?)", getPlayerSerial ( source ), +1 ) addEvent ( "CanRegister", true ) else outputChatBox ("You Can Make Just 2 Accounts",source,255,255,255,true) end addEvent("onRequestRegister",true) addEventHandler("onRequestRegister",getRootElement(),registerPlayer) كذا ؟؟؟ Link to comment
yazan Posted June 11, 2015 Share Posted June 11, 2015 عندك اند ناقص مدري لو في غلط اخر لكن ذا يلي شفته هنا function registerPlayer () -<<<<<<<<<<<<<<<<<<<<<<< local lCheck = executeSQLQuery ( "SELECT AccountsCount FROM Accounts WHERE playerSerial=?", getPlayerSerial ( source ) ) if ( #lCheck <= 2 ) then ---<<<<<<<<<<<< executeSQLQuery ( "INSERT INTO Accounts ( playerSerial, playerAccounts ) VALUES(?,?)", getPlayerSerial ( source ), +1 ) addEvent ( "CanRegister", true ) else outputChatBox ("You Can Make Just 2 Accounts",source,255,255,255,true) end Link to comment
The moVer Posted June 11, 2015 Author Share Posted June 11, 2015 شكرا كثير اما الكود صح؟؟ Link to comment
#DRAGON!FIRE Posted June 11, 2015 Share Posted June 11, 2015 كودكـ خطا .. حاول فهم كودي وقلت لك لو في شي ما فهمته اسئل . Link to comment
The moVer Posted June 11, 2015 Author Share Posted June 11, 2015 حاولت استخدم كودك بس ما ضبط معي Link to comment
#DRAGON!FIRE Posted June 11, 2015 Share Posted June 11, 2015 addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS AccountsMax ( playerSerial, playerAccounts )" ) end ) function registerPlayer ( ) local lCheck = executeSQLQuery ( "SELECT playerAccounts FROM AccountsMax WHERE playerSerial=?", getPlayerSerial ( source ) ) if ( #lCheck == 0 ) then executeSQLQuery ( "INSERT INTO AccountsMax ( playerSerial, playerAccounts ) VALUES(?,?)", getPlayerSerial ( source ), 1 ) addEvent ( "CanRegister", true ) else if ( tonumber ( lCheck[1].playerAccounts ) == 2 ) then outputChatBox ( "You Can Make Just 2 Accounts", source, 255, 255,255,true) else addEvent ( "CanRegister", true ) executeSQLQuery ( "UPDATE AccountsMax SET playerAccounts=? WHERE playerSerial=?", tonumber ( lCheck[1].playerAccounts ) + 1, getPlayerSerial ( source ) ) end end end addEvent ( "onRequestRegister", true ) addEventHandler ( "onRequestRegister", root, registerPlayer ) Link to comment
The moVer Posted June 12, 2015 Author Share Posted June 12, 2015 addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS AccountsMax ( playerSerial, playerAccounts )" ) end ) function regg ( username,password ) registerPlayer (username,password) local lCheck = executeSQLQuery ( "SELECT playerAccounts FROM AccountsMax WHERE playerSerial=?", getPlayerSerial ( source ) ) if ( #lCheck == 0 ) then setElementData ( source, "CanRegister", "Yes") else if ( tonumber ( lCheck[1].playerAccounts ) == 2 ) then setElementData ( source, "CanRegister", "No") else setElementData ( source, "CanRegister", "Yes") end end end addEvent("reg",true) addEventHandler("reg",getRootElement(),regg) function registerPlayer (username,password) local get = getElementData ( source, "CanRegister" ) if ( get ) == "Yes" then if not (username == "") then if not (password == "") then local account = getAccount (username,password) if (account == false) then local accountAdded = addAccount(tostring(username),tostring(password)) if (accountAdded) then outputChatBox ("#FF0000* #FFFFFFYou have sucessfuly registered! [username: #ABCDEF" .. username .. " #FF0000| #FFFFFFPassword: #ABCDEF" .. password .. "#FFFFFF]",source,255,255,255,true ) setTimer(outputChatBox,800,1,"#FF0000* #FFFFFFYou can now login with your new account.",source,255,255,255,true ) else outputChatBox ("#FF0000* #FFFFFFAn unknown error has occured! Please choose a different username/password and try again.",source,255,255,255,true ) end else outputChatBox ("#FF0000* #FFFFFFError! An account with this username already exists!",source,255,255,255,true ) end else outputChatBox ("#FF0000* #FFFFFFError! Please enter a password!",source,255,255,255,true) end else outputChatBox ("#FF0000* #FFFFFFError! Please enter a username you would like to register with!",source,255,255,255,true) end end end صح اني غلبتكم بس وش مشكلة ذا Link to comment
#DRAGON!FIRE Posted June 12, 2015 Share Posted June 12, 2015 addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS AccountsMax ( playerSerial, playerAccounts )" ) end ) function registerPlayer ( username, password ) local lCheck = executeSQLQuery ( "SELECT playerAccounts FROM AccountsMax WHERE playerSerial=?", getPlayerSerial ( source ) ) if ( #lCheck == 0 ) then executeSQLQuery ( "INSERT INTO AccountsMax ( playerSerial, playerAccounts ) VALUES(?,?)", getPlayerSerial ( source ), 1 ) registerPlayer ( source, username, password ) else if ( tonumber ( lCheck[1].playerAccounts ) == 2 ) then outputChatBox ( "You Can Make Just 2 Accounts", source, 255, 255,255,true) else registerPlayer ( source, username, password ) executeSQLQuery ( "UPDATE AccountsMax SET playerAccounts=? WHERE playerSerial=?", tonumber ( lCheck[1].playerAccounts ) + 1, getPlayerSerial ( source ) ) end end end addEvent ( "onRequestRegister", true ) addEventHandler ( "onRequestRegister", root, registerPlayer ) function registerPlayer ( element, username, password ) if not ( username == "" ) then if not ( password == "" ) then local account = getAccount (username,password) if ( account == false ) then local accountAdded = addAccount(tostring(username),tostring(password)) if ( accountAdded ) then outputChatBox ("#FF0000* #FFFFFFYou have sucessfuly registered! [username: #ABCDEF" .. username .. " #FF0000| #FFFFFFPassword: #ABCDEF" .. password .. "#FFFFFF]",element,255,255,255,true ) setTimer(outputChatBox,800,1,"#FF0000* #FFFFFFYou can now login with your new account.",element,255,255,255,true ) else outputChatBox ("#FF0000* #FFFFFFAn unknown error has occured! Please choose a different username/password and try again.",element,255,255,255,true ) end else outputChatBox ("#FF0000* #FFFFFFError! An account with this username already exists!",element,255,255,255,true ) end else outputChatBox ("#FF0000* #FFFFFFError! Please enter a password!",element,255,255,255,true) end else outputChatBox ("#FF0000* #FFFFFFError! Please enter a username you would like to register with!",element,255,255,255,true) end end Link to comment
#DRAGON!FIRE Posted June 12, 2015 Share Posted June 12, 2015 انا ما ادري عن اكوادكـ .. سويت لك الاكواد اللي تحتاجها وواضحة فوق .. في اخطاء بالديبوق ؟ Link to comment
The moVer Posted June 12, 2015 Author Share Posted June 12, 2015 لا ما في بس انا ماني ملاحظ اي خطأ Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now