addEventHandler("onClientResourceStart",resourceRoot,
function()
GUIEditor_Window = {}
GUIEditor_Button = {}
GUIEditor_Label = {}
GUIEditor_Window[1] = guiCreateWindow(430,286,504,269,".:Death Racer Login:.",false)
guiSetAlpha(GUIEditor_Window[1],1)
username_edit = guiCreateEdit(27,32,203,37,"",false,GUIEditor_Window[1])
guiSetAlpha(username_edit,1)
Passwort_edit = guiCreateEdit(29,98,202,36,"",false,GUIEditor_Window[1])
guiSetAlpha(Passwort_edit,1)
GUIEditor_Label[1] = guiCreateLabel(310,-91,5,5,"",false,GUIEditor_Window[1])
GUIEditor_Button[1] = guiCreateButton(30,151,195,100,"Login",false,GUIEditor_Window[1])
guiSetAlpha(GUIEditor_Button[1],1)
Username = guiCreateLabel(249,36,99,32,"Username",false,GUIEditor_Window[1])
guiSetAlpha(Username,1)
guiLabelSetColor(Username,255,0,0)
guiSetFont(Username,"default-bold-small")
Passwort = guiCreateLabel(250,100,64,32,"Passwort",false,GUIEditor_Window[1])
guiSetAlpha(Passwort,1)
guiLabelSetColor(Passwort,0,0,255)
guiSetFont(Passwort,"default-bold-small")
reusername_edit = guiCreateEdit(325,34,166,26,"",false,GUIEditor_Window[1])
guiSetAlpha(reusername_edit,1)
repasswort_edit = guiCreateEdit(330,92,161,33,"",false,GUIEditor_Window[1])
guiSetAlpha(repasswort_edit,1)
GUIEditor_Button[2] = guiCreateButton(334,147,156,41,"Register",false,GUIEditor_Window[1])
guiSetAlpha(GUIEditor_Button[2],1)
GUIEditor_Label[2] = guiCreateLabel(319,239,184,28,"Login/register by Green",false,GUIEditor_Window[1])
guiSetAlpha(GUIEditor_Label[2],1)
guiLabelSetColor(GUIEditor_Label[2],0,255,0)
end
)
guiSetVisible ( GUIEditor_Window[1], false )
local localPlayer = getLocalPlayer ( )
function windowHandler( )
local playername = getPlayerName(localPlayer)
guiSetText(username_edit, "")
guiSetText(passwort_edit, "")
guiSetText(username_edit, playername)
guiSetText(repasswort_edit, playername)
guiSetVisible ( GUIEditor_Window[1], true )
guiSetInputEnabled(true)
showCursor ( true )
end
function onClickBtn ( button, state )
if (source == GUIEditor_Button[1]) then
triggerServerEvent ( "onLogin", getRootElement(), localPlayer, guiGetText(LoginUsername), guiGetText(LoginPassword) )
end
end
function onClickBtn2 ( button, state )
if (source == GUIEditor_Button[2]) then
triggerServerEvent ( "onRegister", getRootElement(), localPlayer, guiGetText(EditRegisterUsername), guiGetText(EditRegisterPassword))
end
end
function hideLoginWindow()
guiSetInputEnabled(false)
guiSetVisible ( GUIEditor_Window[1], false )
showCursor ( false )
end
addEvent( "hideLoginWindow", true )
addEventHandler( "hideLoginWindow", getRootElement(), hideLoginWindow )
addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), windowHandler )
addEventHandler ( "onClientGUIClick", GUIEditor_Button[1], onClickBtn, false )
addEventHandler ( "onClientGUIClick", GUIEditor_Button[2], onClickBtn2, false )
Alles anzeigen
function onLogin ( player, user, pass )
local account = getAccount ( user, pass )
if ( account ~= false ) then
if (logIn ( player, account, pass ) == true) then
triggerClientEvent ( "hideLoginWindow", getRootElement())
else
outputChatBox ( "Login fail!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
else
outputChatBox ( "Falscher Username oder Passwort", player, 255, 255, 0 ) -- Output they got the details wrong.
end
end
addEvent( "onLogin", true )
addEventHandler( "onLogin", getRootElement(), onLogin )
function onRegister ( player, user, pass )
local account = getAccount ( user, pass )
if ( account ~= false ) then
if (logIn ( player, account, pass ) == true) then
triggerClientEvent ( "hideLoginWindow", getRootElement())
else
outputChatBox ( "Login error!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
else
account = addAccount ( user, pass )
if (logIn ( player, account, pass ) == true) then
triggerClientEvent ( "hideLoginWindow", getRootElement())
else
outputChatBox ( "Register/Login error!", player, 255, 255, 0 ) -- Output they got the details wrong.
end
end
end
addEvent( "onRegister", true )
addEventHandler( "onRegister", getRootElement(), onRegister )
Alles anzeigen
Wenn ich in den server joine kommt die maus nicht. WHY