rendered paste body-- ACCOUNT SYSTEM - CLIENTSEITIG-- -- TODO:-- - Clientseitig Login-Daten speichern!-- X Ein Label für alle 3 Fehlermeldugen --(gangbang nigga)-- [DONE ]-- -- loginfails = {}loginfails["namepw"] = "Login Fehlgeschlagen! Falscher Name und/oder Passwort!"loginfails["ban"] = "Der Account wurde gebannt!"loginfails["inactive"] = "Der Account ist (noch) nicht aktiviert!"loginfails["nochar"] = "Der Account hat (noch) keinen aktivierten Charakter! Erstelle dir auf der Webseite einen!"function createWindowLogin()-- LOGIN FENSTER ANFANG -- wndLogin = guiCreateWindow(0.3518,0.7695,0.33,0.2,"Bitte einloggen!",true) guiWindowSetMovable(wndLogin,false) guiWindowSetSizable(wndLogin,false) local temp temp = guiCreateLabel(0.083,0.2,0.25,0.25,"Benutzername",true,wndLogin) guiLabelSetColor(temp,255,255,255) guiLabelSetVerticalAlign(temp,"top") guiLabelSetHorizontalAlign(temp,"left",false) temp = guiCreateLabel(0.083,0.4048,0.25,0.25,"Passwort",true,wndLogin) guiLabelSetColor(temp,255,255,255) guiLabelSetVerticalAlign(temp,"top") guiLabelSetHorizontalAlign(temp,"left",false) temp = guiCreateLabel(0.4603,0.581,0.3249,0.2524,"Name und Passwort speichern",true,wndLogin) guiLabelSetColor(temp,255,255,255) guiLabelSetVerticalAlign(temp,"top") guiLabelSetHorizontalAlign(temp,"left",false) edtLoginUser = guiCreateEdit(0.4152,0.2,0.5,0.1,"",true,wndLogin) edtLoginPass = guiCreateEdit(0.4152,0.4048,0.5,0.1,"",true,wndLogin) guiEditSetMaxLength(edtLoginUser, 35); guiEditSetMaxLength(edtLoginPass, 35); chkLoginSave = guiCreateCheckBox(0.4152,0.581,0.0343,0.0762,"",false,true,wndLogin) lblLoginError = guiCreateLabel(0.083,0.881,0.9007,0.1,"",true,wndLogin) guiLabelSetColor(lblLoginError,255,0,0) guiLabelSetVerticalAlign(lblLoginError,"top") guiLabelSetHorizontalAlign(lblLoginError,"left", false) btnLoginLogin = guiCreateButton(0.4152,0.7333,0.2509,0.1,"Einloggen",true,wndLogin) addEventHandler("onClientGUIClick", btnLoginLogin, clientSubmitLogin, false) guiSetVisible(wndLogin, false)-- LOGIN FENSTER ENDE --endfunction LoadSavedAccount() if g_Settings == nil then LoadSettings() end if(g_Settings["saveacc"] == "yes") then if(g_Settings["saved_name"] == nil) then g_Settings["saved_name"] = "" end if(g_Settings["saved_pass"] == nil) then g_Settings["saved_pass"] = "" end guiSetText(edtLoginUser, g_Settings["saved_name"]) guiSetText(edtLoginPass, g_Settings["saved_pass"]) guiCheckBoxSetSelected(chkLoginSave, true) endendfunction SaveAccount(username,password) if(guiCheckBoxGetSelected(chkLoginSave) == true) then g_Settings["saveacc"] = "yes" g_Settings["saved_name"] = username g_Settings["saved_pass"] = password else g_Settings["saveacc"] = "no" end SaveSettings()endfunction clientSubmitLogin(button,state) if button == "left" and state == "up" then local username = guiGetText(edtLoginUser) local password = guiGetText(edtLoginPass) if username and password and username ~= "" and password ~= "" then fadeCamera( false ) guiSetInputEnabled(false) guiSetVisible(wndLogin, false) guiSetText(lblLoginError, "") showCursor(false) SaveAccount( username, password ) triggerServerEvent("submitLogin", getRootElement(), username, password) else outputChatBox("Bitte Benutzername und Passwort eingeben!", 255,0,0, true) end endendfunction loginFailedHandler(freason) if (wndLogin ~= nil) then showCursor(true) guiSetInputEnabled(true) fadeCamera( true ) if(loginfails[freason] == nil) then guiSetText(lblLoginError, "Unerwarteter Fehler! ID: CR_LOGIN3! Bitte melden!") else guiSetText(lblLoginError, "Fehler: " .. loginfails[freason]) end guiSetVisible(wndLogin, true) else outputChatBox("-- Unerwarteter Fehler! ID: CR_LOGIN2! Bitte melden!", 255, 0, 0, false) end endaddEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()), function () createWindowLogin() outputChatBox("Willkommen auf realMTA! Bitte einloggen!", 255, 255, 255, true); setCameraMatrix(1921.6399,-1515.6221,301.1566, 1610.5598,-1291.5786,265.5183) fadeCamera( true ) if (wndLogin ~= nil) then LoadSavedAccount() guiSetVisible(wndLogin, true) showCursor(true) guiSetInputEnabled(true) else outputChatBox("-- Unerwarteter Fehler! ID: CR_LOGIN1! Bitte melden!", 255, 0, 0, false); end end)addEvent("loginFailed",true)addEventHandler("loginFailed",getRootElement(),loginFailedHandler)