Jump to content

X[مشكلة]X لوحة تسجيل


Recommended Posts

سلام عليكم

ممكن حل للخطا الوحة ؟

بس اضغط register ما بسجل

ليش ؟

+ لما اضغط login الوحة تروح ويكتب لو الحساب خطا او كلمة مرور

وانا بكون عندي حساب قبل

الكودات

كلينت

GUIEditor = { 
    edit = {}, 
    button = {}, 
    label = {}, 
    window = {}, 
} 
GUIEditor.window[1] = guiCreateWindow(357, 112, 650, 546, "Login ~ Register ", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF29FC00") 
  
GUIEditor.label[1] = guiCreateLabel(45, 104, 148, 40, "اسم الحساب ", false, GUIEditor.window[1]) 
guiLabelSetColor(GUIEditor.label[1], 251, 253, 0) 
GUIEditor.edit[1] = guiCreateEdit(174, 94, 377, 50, "", false, GUIEditor.window[1]) 
GUIEditor.label[2] = guiCreateLabel(66, 214, 148, 40, "باسورد", false, GUIEditor.window[1]) 
guiLabelSetColor(GUIEditor.label[2], 251, 253, 0) 
GUIEditor.edit[2] = guiCreateEdit(174, 194, 377, 50, "", false, GUIEditor.window[1]) 
GUIEditor.button[1] = guiCreateButton(66, 297, 165, 66, "login", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
GUIEditor.button[2] = guiCreateButton(464, 297, 165, 66, "guest", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000") 
GUIEditor.button[3] = guiCreateButton(271, 297, 165, 66, "register", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFF0000") 
triggerServerEvent("onGetSave",localPlayer) 
showCursor ( true ) 
  
  
addEvent("onPutSave",true) 
addEventHandler("onPutSave",root, 
    function (puser,ppass) 
        guiSetText(user,puser) 
        guiSetText(pass,ppass) 
    end 
) 
  
  
addEventHandler("onClientGUIClick",root, 
    function () 
        local user = guiGetText(user) 
        local pass = guiGetText(pass) 
        if ( source == GUIEditor.button[1] ) then 
            if user ~= "" and pass ~= "" then 
                if guiCheckBoxGetSelected(remember) then 
                    triggerServerEvent("onLoginWith",localPlayer,user,pass) 
                else 
                    triggerServerEvent("onLogin",localPlayer,user,pass) 
                end 
            else 
                outputChatBox("* You Must Write Username Or Password",255,0,0) 
            end 
        elseif ( source == GUIEditor.button[3] ) then 
            if user ~= "" and pass ~= "" then 
                triggerServerEvent("onReg",localPlayer,user,pass) 
            else 
                outputChatBox("* You Must Write Username Or Password",255,0,0) 
            end 
        end 
    end 
) 
  
---------------------------------------------------------------------------- 
addEventHandler ( "onClientGUIClick", resourceRoot, function (    ) 
    if ( source == GUIEditor.button[1] ) then 
        guiSetVisible ( GUIEditor.window[1], false ) 
        showCursor ( false ) 
    end 
end ) 
addEventHandler ( "onClientGUIClick", resourceRoot, function (    ) 
    if ( source == GUIEditor.button[2] ) then 
        guiSetVisible (  
  
GUIEditor.window[1], false ) 
        showCursor ( false ) 
    end 
end ) 

سيرفر

  
  
executeSQLQuery("CREATE TABLE IF NOT EXISTS players_save( serial TEXT, user TEXT, pass TEXT)") 
  
function AddPlayer(serial,user,pass) 
    executeSQLQuery("INSERT INTO players_save(serial,user,pass) VALUES(?,?,?)",serial,user,pass) 
end 
  
function isPlayerSave(serial) 
    local sel = executeSQLQuery("SELECT serial FROM players_save WHERE serial=?",serial) 
    if sel == 0 then 
        return false 
    else 
        return true 
    end 
end 
  
function getUserAndPass(serial) 
    local user,pass = "","" 
    if isPlayerSave(serial) then 
        local sel = executeSQLQuery("SELECT * FROM players_save WHERE serial=?",serial) 
        for i,player in ipairs(sel) do 
            if i == 1 then 
                user = player.user 
                pass = player.pass 
            end 
        end 
        return user,pass 
    end 
    return false 
end 
  
addEvent("onGetSave",true) 
addEventHandler("onGetSave",root, 
    function () 
        local serial = getPlayerSerial(source) 
        if isPlayerSave(serial) then 
            local user,pass = getUserAndPass(serial) 
            triggerClientEvent(source,"onPutSave",source,user,pass) 
        end 
    end 
) 
  
addEvent("onLoginWith",true) 
addEventHandler("onLoginWith",root, 
    function (user,pass) 
        local acc = getAccount(user,pass) 
        local serial = getPlayerSerial(source) 
        if acc then 
            logIn(source,acc,pass) 
            outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0) 
            AddPlayer(serial,user,pass) 
            triggerClientEvent(source,"onCl",source) 
        else 
            outputChatBox("* الحساب او كلمة المرور خطأ",source,255,0,0) 
        end 
    end 
) 
  
addEvent("onLogin",true) 
addEventHandler("onLogin",root, 
    function (user,pass) 
        local acc = getAccount(user,pass) 
        if acc then 
            logIn(source,acc,pass) 
            outputChatBox("* تم بنجاح تسجيل دخول",source,0,255,0) 
            triggerClientEvent(source,"onCl",source) 
        else 
            outputChatBox("* الحساب او كلمة مرور خطأ",source,255,0,0) 
        end 
    end 
) 
  
addEvent("onReg",true) 
addEventHandler("onReg",root, 
    function (user,pass) 
        local acc = getAccount(user,pass) 
        if acc then 
            outputChatBox("* هذا الحساب مستخدم من قبل",source,255,0,0) 
        else 
            addAccount(user,pass) 
            outputChatBox("* Username = " .. user .. "",source,0,255,0) 
            outputChatBox("* Password = " .. pass .. "",source,0,255,0) 
        end 
    end 
) 

Edited by Guest
Link to comment

جرب بدل الكلنت كذا

GUIEditor = { 
    edit = {}, 
    button = {}, 
    label = {}, 
    window = {}, 
} 
GUIEditor.window[1] = guiCreateWindow(357, 112, 650, 546, "Login ~ Register ", false) 
guiWindowSetSizable(GUIEditor.window[1], false) 
guiSetProperty(GUIEditor.window[1], "CaptionColour", "FF29FC00") 
  
GUIEditor.label[1] = guiCreateLabel(45, 104, 148, 40, "اسم الحساب ", false, GUIEditor.window[1]) 
guiLabelSetColor(GUIEditor.label[1], 251, 253, 0) 
GUIEditor.edit[1] = guiCreateEdit(174, 94, 377, 50, "", false, GUIEditor.window[1]) 
GUIEditor.label[2] = guiCreateLabel(66, 214, 148, 40, "باسورد", false, GUIEditor.window[1]) 
guiLabelSetColor(GUIEditor.label[2], 251, 253, 0) 
GUIEditor.edit[2] = guiCreateEdit(174, 194, 377, 50, "", false, GUIEditor.window[1]) 
GUIEditor.button[1] = guiCreateButton(66, 297, 165, 66, "login", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[1], "NormalTextColour", "FFFF0000") 
GUIEditor.button[2] = guiCreateButton(464, 297, 165, 66, "guest", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[2], "NormalTextColour", "FFFF0000") 
GUIEditor.button[3] = guiCreateButton(271, 297, 165, 66, "register", false, GUIEditor.window[1]) 
guiSetProperty(GUIEditor.button[3], "NormalTextColour", "FFFF0000") 
triggerServerEvent("onGetSave",localPlayer) 
showCursor ( true ) 
  
  
addEvent("onPutSave",true) 
addEventHandler("onPutSave",root, 
    function (puser,ppass) 
        guiSetText(GUIEditor.edit[1],puser) 
        guiSetText(GUIEditor.edit[2],ppass) 
    end 
) 
  
  
addEventHandler("onClientGUIClick",root, 
    function () 
        local user = guiGetText(GUIEditor.edit[1]) 
        local pass = guiGetText(GUIEditor.edit[2]) 
        if ( source == GUIEditor.button[1] ) then 
            if user ~= "" and pass ~= "" then 
                if guiCheckBoxGetSelected(remember) then 
                    triggerServerEvent("onLoginWith",localPlayer,user,pass) 
                else 
                    triggerServerEvent("onLogin",localPlayer,user,pass) 
                end 
            else 
                outputChatBox("* You Must Write Username Or Password",255,0,0) 
            end 
        elseif ( source == GUIEditor.button[3] ) then 
            if user ~= "" and pass ~= "" then 
                triggerServerEvent("onReg",localPlayer,user,pass) 
            else 
                outputChatBox("* You Must Write Username Or Password",255,0,0) 
            end 
        end 
    end 
) 
  
---------------------------------------------------------------------------- 
  

Link to comment

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...