AboShanab Posted March 27, 2013 Share Posted March 27, 2013 (edited) السسلام عليكم ورحمة الله وبرككاته .. اخباركم شباب ؟؟ عساكم بالف خير .. طلبتكم اليوم تشرحون لي كيف اخلي المود يسوي حفظ في قاعدة البيانات .. مثلا ابيه يحفظ الـ حسابات والباسوردات في SQL يسوي له Tab جديد ويحط فيه SaveSystemAccounts واللي يبي حق التسجيل + تسجيل الدخول حقي addEvent("onLogin", true) addEventHandler("onLogin",root, function (player, user, pass) local account = getAccount ( user, pass ) if ( account ~= true ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Logged in Sucessfuly!", player, 255, 255, 0 , true ) else outputChatBox ( "Login Error!", player, 255, 0, 0 ) end else outputChatBox ( "Wrong username or password!", player, 255, 0, 0 ) end end ) addEvent("onReg", true) addEventHandler("onReg",root, function ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) else outputChatBox ( "You Are Already Logged in !", player, 255, 255, 0 ) end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) else outputChatBox ( "Register Error !", player, 255, 0, 0 ) end end end ) وششكرا Edited March 29, 2013 by Guest Link to comment
][sojn][ Posted March 27, 2013 Share Posted March 27, 2013 executeSQLQuery كيف يعني اشرح لنا كيف نسويها ياليت سعد او احمد فيف يسوون موضوع عن SQL Link to comment
AboShanab Posted March 27, 2013 Author Share Posted March 27, 2013 (edited) مثلا كذا مضبوط ؟؟ executeSQLQuery("CREATE TABLE IF NOT EXISTS SaveSystemAccounts (Accounts TEXT,Test NUMBER,Pass") Edited March 27, 2013 by Guest Link to comment
iPrestege Posted March 27, 2013 Share Posted March 27, 2013 No : addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Register (values)" ) end ) Link to comment
AboShanab Posted March 27, 2013 Author Share Posted March 27, 2013 No : addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Register (values)" ) end ) وين احط اسم الـتاب اللي ابيه ؟ Link to comment
][sojn][ Posted March 27, 2013 Share Posted March 27, 2013 viewtopic.php?f=148&t=38203 مشكور Link to comment
PaiN^ Posted March 27, 2013 Share Posted March 27, 2013 viewtopic.php?f=148&t=38203 مشكور العفوو Link to comment
iPrestege Posted March 27, 2013 Share Posted March 27, 2013 مثلا كذا مضبوط؟؟ executeSQLQuery("CREATE TABLE IF NOT EXISTS SaveSystemAccounts (Accounts TEXT,Test NUMBER,Pass") عدلتة يوم شفت ردي؟ Link to comment
AboShanab Posted March 27, 2013 Author Share Posted March 27, 2013 addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SaveSystemByAboShanab (NameAccount,Password)" ) end ) function setSaveSystemByAboShanab ( NameAccount, Password ) return executeSQLQuery ( "INSERT INTO `SaveSystemByAboShanab` ( `NameAccount`, `Password` ) VALUES ( ?, ? )", tostring(user), tostring(pass) ) end شغال ؟ Link to comment
|Mr|-Talal07-| Posted March 27, 2013 Share Posted March 27, 2013 addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SaveSystemByAboShanab (NameAccount,Password)" ) end ) function setSaveSystemByAboShanab ( NameAccount, Password ) return executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", tostring(NameAccount), tostring(Password) ) end function getAccountsInTable() return executeSQLQuery("SELECT * FROM SaveSystemByAboShanab") end Link to comment
AboShanab Posted March 28, 2013 Author Share Posted March 28, 2013 اخوي طلال .. مرتب كل شي .. يسوي الـ tab وكل شي لاكن اذا سجلت ما يحط اسم الحساب داخل القاعدة + الباس .. .. ممكن حل ي شباب .. Link to comment
AboShanab Posted March 28, 2013 Author Share Posted March 28, 2013 طيب لو ناخذ هذي الاشياء من مود بريستيج == addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SaveSystemByAboShanab (NameAccount,Password)" ) end ) function setSaveSystemByAboShanab ( NameAccount, Password ) return executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", tostring(NameAccount), tostring(Password) ) end function SelectFromSql ( ) local data = executeSQLQuery ( "SELECT * FROM SaveSystemByAboShanab" ) if ( type ( data ) == "table" and #data == 0) or not data then return { } else return data end end addEvent ( "RefreshList", true ) addEventHandler ( "RefreshList", root, function ( ) UpDateListInSql ( source ) end ) addEvent ( "Save:To:Data:Base", true ) addEventHandler ( "Save:To:Data:Base", root, function ( user, pass ) setSQL_Data ( user, pass ) end ) كذا يضبط ولا لا ؟ Link to comment
PaiN^ Posted March 28, 2013 Share Posted March 28, 2013 فنكشنات هو مسويها, مو فنكشنات معرفة من اللعبة setSQL_Data و UpDateListInSql لآ, لآن Link to comment
AboShanab Posted March 29, 2013 Author Share Posted March 29, 2013 بعد التعديل عليه addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SaveSystemByAboShanab (NameAccount,Password)" ) end ) function setSaveSystemByAboShanab ( NameAccount, Password ) return executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", tostring(NameAccount), tostring(Password) ) end function SelectFromSql ( ) local data = executeSQLQuery ( "SELECT * FROM SaveSystemByAboShanab" ) if ( type ( data ) == "table" and #data == 0) or not data then return { } else return data end end addEvent ( "RefreshList", true ) addEventHandler ( "RefreshList", root, function ( ) UpDateListInSql ( source ) end ) addEvent ( "Save:To:Data:Base", true ) addEventHandler ( "Save:To:Data:Base", root, function ( user, pass ) setSaveSystemByAboShanab ( user, pass ) end ) كود تسجيل الدخول + التسجيل addEvent("onLogin", true) addEventHandler("onLogin",root, function (player, user, pass) local account = getAccount ( user, pass ) if ( account ~= true ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Logged in Sucessfuly!", player, 255, 255, 0 , true ) executeSQLInsert ( "NameAccount", ""..user .."Password", ""..pass .."" ) else outputChatBox ( "Login Error!", player, 255, 0, 0 ) end else outputChatBox ( "Wrong username or password!", player, 255, 0, 0 ) end end ) addEvent("onReg", true) addEventHandler("onReg",root, function ( player, user, pass ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) executeSQLInsert ( "NameAccount", ""..user .."Password", ""..pass .."" ) else outputChatBox ( "You Are Already Logged in !", player, 255, 255, 0 ) end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) executeSQLInsert ( "NameAccount", ""..user .."Password", ""..pass .."" ) else outputChatBox ( "Register Error !", player, 255, 0, 0 ) end end end ) ماضبطط وش الحل ؟؟ Link to comment
iPrestege Posted March 29, 2013 Share Posted March 29, 2013 كيف تصير؟؟؟ setSaveSystemByAboShanab ( NameAccount, Password ) وعند الدخول والتسجيل pass,user ^ أول خطأ Link to comment
AboShanab Posted March 29, 2013 Author Share Posted March 29, 2013 function setSaveSystemByAboShanab ( user, pass, NameAccount, Password ) return executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", tostring(user), tostring(pass) ) end يعني يصير هيك ؟؟ Link to comment
iPrestege Posted March 29, 2013 Share Posted March 29, 2013 سوي قيت تكست من الكلنت وارسلة سيرفر للحفظ في القاعدهـ وسوي الحفظ للي سحبتة من القيت تكست Link to comment
AboShanab Posted March 29, 2013 Author Share Posted March 29, 2013 ي لبيه ي بريستيججج ييييييي لبيهه وربي انككك مملكك تم الحل تم الحل ذذ .. يعطيك الف الف عافية addEvent("onLogin", true) addEventHandler("onLogin",root, function (player, user, pass, NameAccount, Password) local account = getAccount ( user, pass ) if ( account ~= true ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Logged in Sucessfuly!", player, 255, 255, 0 , true ) executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", user, pass ) else outputChatBox ( "Login Error!", player, 255, 0, 0 ) end else outputChatBox ( "Wrong username or password!", player, 255, 0, 0 ) end end ) addEvent("onReg", true) addEventHandler("onReg",root, function ( player, user, pass, NameAccount, Password ) local account = getAccount ( user, pass ) if ( account ~= false ) then if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", user, pass ) else outputChatBox ( "You Are Already Logged in !", player, 255, 255, 0 ) end else account = addAccount ( user, pass ) if (logIn ( player, account, pass ) == true) then outputChatBox ( "You Registerd and Logged in Sucessfuly!", player, 255, 255, 0 ) executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", user, pass ) else outputChatBox ( "Register Error !", player, 255, 0, 0 ) end end end ) الثانين addEventHandler ( "onResourceStart", resourceRoot, function ( ) executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SaveSystemByAboShanab (NameAccount,Password)" ) end ) function setSaveSystemByAboShanab ( user, pass, NameAccount, Password ) return executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", tostring(user), tostring(pass) ) end function SelectFromSql ( ) local data = executeSQLQuery ( "SELECT * FROM SaveSystemByAboShanab" ) if ( type ( data ) == "table" and #data == 0) or not data then return { } else return data end end addEvent ( "RefreshList", true ) addEventHandler ( "RefreshList", root, function ( ) UpDateListInSql ( source ) end ) addEvent ( "Save:To:Data:Base", true ) addEventHandler ( "Save:To:Data:Base", root, function ( user, pass ) setSaveSystemByAboShanab ( user, pass ) end ) يعطيك مليون ترليون عافية Link to comment
iPrestege Posted March 29, 2013 Share Posted March 29, 2013 الله يعافيك المرهـ الجآية آي مود آنزلة ركز فية انا كنت مسوي قيت تكست من الاصل ذذ 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