Jump to content

SQL Save Tnx Mr.Pres[T]ege ^_^


Recommended Posts

Posted (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 by Guest

Skype : aboshanab_

Posted
executeSQLQuery 

كيف يعني اشرح لنا كيف نسويها

ياليت سعد او احمد فيف يسوون موضوع عن SQL

lgQ0m.png

مطلوب سيرفر ابرمج فيه -_-

ضيفني سكايب

Sojn_999

Posted (edited)

مثلا كذا مضبوط

؟؟

  
executeSQLQuery("CREATE TABLE IF NOT EXISTS SaveSystemAccounts (Accounts TEXT,Test NUMBER,Pass") 
  
Edited by Guest

Skype : aboshanab_

Posted

No :

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Register (values)" ) 
    end 
) 
  

  

Posted
No :

addEventHandler ( "onResourceStart", resourceRoot, 
    function ( ) 
        executeSQLQuery ( "CREATE TABLE IF NOT EXISTS SQL_Register (values)" ) 
    end 
) 
  

وين احط اسم الـتاب اللي ابيه ؟

Skype : aboshanab_

Posted
مثلا كذا مضبوط

؟؟

  
executeSQLQuery("CREATE TABLE IF NOT EXISTS SaveSystemAccounts (Accounts TEXT,Test NUMBER,Pass") 
  

:lol::lol: عدلتة يوم شفت ردي؟

  

Posted

  
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 
  

شغال ؟

Skype : aboshanab_

Posted
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 

Retired.

Posted

اخوي طلال ..

مرتب كل شي ..

يسوي الـ tab وكل شي

لاكن اذا سجلت ما يحط اسم الحساب داخل القاعدة + الباس ..

.. ممكن حل ي شباب ..

Skype : aboshanab_

Posted

طيب لو ناخذ هذي الاشياء من مود بريستيج ==

  
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 
) 
  

كذا يضبط ولا لا ؟

Skype : aboshanab_

Posted

فنكشنات هو مسويها, مو فنكشنات معرفة من اللعبة setSQL_Data و UpDateListInSql لآ, لآن

" Keep Thinking Different . " - Steve Jops

--------------------

Don't send me PMs asking for help, I Won't reply !

Posted

بعد التعديل عليه

  
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 
) 
  

ماضبطط وش الحل ؟؟

Skype : aboshanab_

Posted

  
function setSaveSystemByAboShanab ( user, pass, NameAccount, Password ) 
    return executeSQLQuery ( "INSERT INTO SaveSystemByAboShanab ( NameAccount, Password ) VALUES ( ?, ? )", tostring(user), tostring(pass) ) 
end 
  

يعني يصير هيك ؟؟

Skype : aboshanab_

Posted

سوي قيت تكست من الكلنت وارسلة سيرفر للحفظ في القاعدهـ وسوي الحفظ للي سحبتة من القيت تكست

  

Posted

ي لبيه ي بريستيججج ييييييي لبيهه

وربي انككك مملكك تم الحل تم الحل ذذ ..

يعطيك الف الف عافية ^_^

  
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 
) 
  

يعطيك مليون ترليون عافية ^_^

Skype : aboshanab_

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...