السلام عليكم
انا قمت بعمل لوحة تسجيل الدخول و حطيت الكود و ما اشتغل
وش الخطأ
GUIEditor = {
button = {},
window = {},
memo = {}
}
addEventHandler("onClientResourceStart", resourceRoot,
function()
GUIEditor.window[1] = guiCreateWindow(457, 229, 641, 616, "Login Panel", false)
guiWindowSetSizable(GUIEditor.window[1], false)
GUIEditor.button[1] = guiCreateButton(22, 99, 146, 69, "Login", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[1], "sa-header")
GUIEditor.button[2] = guiCreateButton(23, 245, 145, 73, "Register", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[2], "sa-header")
GUIEditor.memo[1] = guiCreateMemo(205, 109, 155, 41, "", false, GUIEditor.window[1])
GUIEditor.memo[2] = guiCreateMemo(405, 109, 155, 41, "", false, GUIEditor.window[1])
GUIEditor.memo[3] = guiCreateMemo(206, 267, 155, 41, "", false, GUIEditor.window[1])
GUIEditor.memo[4] = guiCreateMemo(405, 267, 155, 41, "", false, GUIEditor.window[1])
GUIEditor.button[3] = guiCreateButton(215, 221, 127, 36, "Username", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[3], "clear-normal")
GUIEditor.button[4] = guiCreateButton(410, 221, 127, 36, "Passworld", false, GUIEditor.window[1])
guiSetFont(GUIEditor.button[4], "clear-normal")
GUIEditor.button[5] = guiCreateButton(215, 63, 127, 36, "Username", false, GUIEditor.window[1])
GUIEditor.button[6] = guiCreateButton(423, 63, 127, 36, "Passworld", false, GUIEditor.window[1])
GUIEditor.button[7] = guiCreateButton(23, 349, 109, 28, "Updates", false, GUIEditor.window[1])
GUIEditor.memo[5] = guiCreateMemo(16, 387, 615, 219, "My Updates Here", false, GUIEditor.window[1])
end
)
unction registerPlayer ( source, commandName, password )
-- Check if the password field is blank or not (only blank if they didnt enter one)
if ( password ~= "" and password ~= nil ) then
--Attempt to add the account, and save its value in a var
local accountAdded = addAccount( getPlayerName(source), password )
if ( accountAdded ) then
-- Tell the user all is done
outputChatBox ( "Thank you " .. getPlayerName(source) .. ", you're now registed, you can login with /login", source )
else
-- There was an error making the account, tell the user
outputChatBox ( "Error creating account, contact the server admin", source )
end
else
-- There was an error in the syntax, tell the user the correct syntax.
outputChatBox ( "Error creating account, correct syntax: /register ", source )
end
end
addCommandHandler ( "register", registerPlayer ) -- add the command handler
function loginPlayer ( thePlayer, command, username, password )
local account = getAccount ( username, password ) -- Return the account
if ( account ~= false ) then -- If the account exists.
logIn ( thePlayer, account, password ) -- Log them in.
else
outputChatBox ( "Wrong username or password!", thePlayer, 255, 255, 0 ) -- Output they got the details wrong.
end
end
addCommandHandler ( "log-in", loginPlayer ) -- Make it trigger for "/log-in", NOTE: /login is hardcored and cannot be used.
unction funcInput ( player, key, keyState )
local state = "let go of"
if ( keyState == "down" ) then
state = "pressed"
end
outputChatBox ( getPlayerName ( player) .. " " .. state .. " the " .. key .. " key!" )
end
function bindTheKeys ( player, commandName )
bindKey ( player, "F1", "down", funcInput ) -- bind the player's F1 down key
bindKey ( player, "F1", "up", funcInput ) -- bind the player's F1 up key
bindKey ( player, "fire", "both", funcInput ) -- bind the player's fire down and up control
end
addCommandHandler ( "bindme", bindTheKeys )