Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local Guivar = 0
- local LOFenster = {}
- local LOTabPanel = {}
- local LOTab = {}
- local LOKnopf = {}
- local LOLabel = {}
- local LOEdit = {}
- local LORadio = {}
- local LOGrid = {}
- local LOBild = {}
- function createEinloggMenue()
- if(Guivar == 1) then return end
- Guivar = 1
- showCursor(true)
- guiSetInputMode("no_binds_when_editing")
- local X, Y, Width, Height = getMiddleGuiPosition(540,376)
- LOFenster[1] = guiCreateWindow(X, Y, Width, Height,"Willkommen auf Multistunt!",false)
- LOTabPanel[1] = guiCreateTabPanel(9,22,525,345,false,LOFenster[1])
- LOTab[1] = guiCreateTab("Einloggen",LOTabPanel[1])
- LOBild[1] = guiCreateStaticImage(5,2,507,80,"data/images/logo.png",false,LOTab[1])
- LOLabel[1] = guiCreateLabel(8,87,505,58,"Willkommen auf Multistunt!\nDein Account wurde gefunden, bitte logge dich ein!\nFalls du noch kein Account hast, waehle bitte einen anderen Namen.\nFalls du dein Passwort vergessen hast, frage bitte ein Admin!",false,LOTab[1])
- guiLabelSetHorizontalAlign(LOLabel[1],"center",false)
- guiSetFont(LOLabel[1],"default-bold-small")
- LOLabel[2] = guiCreateLabel(232,182,79,18,"Passwort:",false,LOTab[1])
- guiSetFont(LOLabel[2],"default-bold-small")
- LOLabel[3] = guiCreateLabel(10,139,507,19,"_____________________________________________________________________________",false,LOTab[1])
- guiLabelSetColor(LOLabel[3],0, 255, 0)
- LOEdit[1] = guiCreateEdit(102,203,333,35,"12345",false,LOTab[1]) -- Login
- guiEditSetMasked(LOEdit[1],true)
- LOKnopf[1] = guiCreateButton(189,244,149,29,"Einloggen",false,LOTab[1])
- LOTab[2] = guiCreateTab("Regestrieren",LOTabPanel[1])
- LOBild[2] = guiCreateStaticImage(5,2,509,84,"data/images/logo.png",false,LOTab[2])
- LOLabel[4] = guiCreateLabel(8,86,443,18,"Willkommen auf Multistunt! Du hast noch kein Account. Bitte Regestriere dich!",false,LOTab[2])
- guiSetFont(LOLabel[4],"default-bold-small")
- LOLabel[5] = guiCreateLabel(22,143,192,16,"Name: "..getPlayerName(gMe),false,LOTab[2])
- guiSetFont(LOLabel[5],"default-bold-small")
- LOLabel[6] = guiCreateLabel(22,167,45,16,"Alter:",false,LOTab[2])
- guiSetFont(LOLabel[6],"default-bold-small")
- LOEdit[2] = guiCreateEdit(67,164,52,22,"",false,LOTab[2]) -- Alter
- LOLabel[7] = guiCreateLabel(17,112,321,19,"_____________________________________________",false,LOTab[2])
- guiLabelSetColor(LOLabel[7],0, 255, 255)
- guiSetFont(LOLabel[7],"default-bold-small")
- LOLabel[8] = guiCreateLabel(21,193,99,19,"Passwort:(2x)",false,LOTab[2])
- guiSetFont(LOLabel[8],"default-bold-small")
- LOEdit[3] = guiCreateEdit(21,212,106,24,"",false,LOTab[2]) -- PW1
- guiEditSetMasked(LOEdit[3],true)
- LOEdit[4] = guiCreateEdit(21,243,106,24,"",false,LOTab[2]) -- PW2
- guiEditSetMasked(LOEdit[4],true)
- LOLabel[9] = guiCreateLabel(181,142,74,16,"Herkunft:",false,LOTab[2])
- guiSetFont(LOLabel[9],"default-bold-small")
- LOGrid[1] = guiCreateGridList(174,159,157,117,false,LOTab[2])
- guiGridListSetSelectionMode(LOGrid[1],1)
- guiGridListAddColumn(LOGrid[1],"Land",0.6)
- local row = guiGridListAddRow(LOGrid[1])
- guiGridListSetItemText(LOGrid[1], row, 1, "Deutschland", false, false)
- local row = guiGridListAddRow(LOGrid[1])
- guiGridListSetItemText(LOGrid[1], row, 1, "Oesterreich", false, false)
- local row = guiGridListAddRow(LOGrid[1])
- guiGridListSetItemText(LOGrid[1], row, 1, "Schweiz", false, false)
- LOLabel[10] = guiCreateLabel(342,141,89,19,"Geschlecht:",false,LOTab[2])
- guiSetFont(LOLabel[10],"default-bold-small")
- LORadio[1] = guiCreateRadioButton(342,164,112,22,"Maennlich",false,LOTab[2])
- LORadio[2] = guiCreateRadioButton(342,183,112,22,"Weiblich",false,LOTab[2])
- guiRadioButtonSetSelected(LORadio[1],true)
- LOKnopf[2] = guiCreateButton(361,218,127,31,"Regestrieren",false,LOTab[2])
- LOKnopf[3] = guiCreateButton(361,253,127,31,"Abbrechen",false,LOTab[2])
- guiSetVisible(LOFenster[1], false)
- addEventHandler("onClientGUIClick", LOEdit[1],
- function()
- local passwort = guiGetText(LOEdit[1])
- if(passwort == "12345") then guiSetText(LOEdit[1], "") end
- end, false)
- addEventHandler("onClientGUIClick", LOKnopf[1],
- function()
- local passwort = guiGetText(LOEdit[1])
- triggerServerEvent("onAccountLogin", gMe, passwort)
- showCursor(false)
- outputChatBox("Bitte Warten...", 0, 255, 255)
- end, false)
- addEvent("onAccountLoginBack", true)
- addEventHandler("onAccountLoginBack", getRootElement(),
- function(sucess)
- if(sucess == true) then
- guiSetVisible(LOFenster[1], false)
- Guivar = 0
- showCursor(false)
- else
- end
- end)
- addEventHandler("onClientGUIClick", LOKnopf[2],
- function()
- local alter = tonumber(guiGetText(LOEdit[2]))
- local pw1, pw2 = guiGetText(LOEdit[3]), guiGetText(LOEdit[4])
- local maennlich, weiblich = guiRadioButtonGetSelected(LORadio[1]), guiRadioButtonGetSelected(LORadio[2])
- local geschlecht = 0
- if(maennlich == true) then geschlecht = 1
- elseif(weiblich == true) then geschlecht = 2 end
- local land = guiGridListGetItemText(LOGrid[1], guiGridListGetSelectedItem(LOGrid[1]), 1)
- if not(alter) then outputChatBox("Ungueltiges Alter!", 255, 0, 0) return end
- if (alter < 14) or (alter > 99) then outputChatBox("Ungueltiges Alter!", 255, 0, 0) return end
- if(string.len(pw1) < 4) or (string.len(pw1) > 20) then outputChatBox("Dein Passwort darf Maximal 20 Zeichen, und Minimal 4 Zeichen lang sein!", 255, 0, 0, 0) return end
- if(pw1 == "12345") or (pw1 == "1234") or (pw1 == "123") or (pw1 == "123456") or (pw1 == "1234567") or (pw1 == "12345678") or (pw1 == "Hallo") then outputChatBox("Dieses Passwort darfst du nicht verwenden!", 255, 0, 0, false) return end
- if(pw1 ~= pw2) then outputChatBox("Die Passwoerter stimmen nicht ueberein!", 255, 0, 0, false) return end
- if(land == "") or (land == " ") then outputChatBox("Bitte waehle ein Land aus!", 255, 0, 0, false) return end
- local landvar = 0
- if(land == "Deutschland") then landvar = 1 end
- if(land == "Oesterreich") then landvar = 2 end
- if(land == "Schweiz") then landvar = 3 end
- if(landvar == 0) then outputChatBox("Fehler!", 255, 0, 0, false) return end
- triggerServerEvent("onAccountRegister", gMe, alter, pw1, geschlecht, landvar)
- showCursor(false)
- outputChatBox("Bitte Warten...", 0, 255, 255)
- end, false)
- addEvent("showLoginCursor", true)
- addEventHandler("showLoginCursor", getRootElement(), function() showCursor(true) end)
- end
- addEventHandler("onClientResourceStart", getResourceRootElement(getThisResource()),
- function()
- createEinloggMenue()
- if(getElementData(gMe, "ms.eingeloggt") ~= true) then
- triggerServerEvent("onLoginDataNeed", gMe)
- addEvent("onLoginDataNeedBack", true)
- addEventHandler("onLoginDataNeedBack", getRootElement(),
- function(rofl)
- guiSetVisible(LOFenster[1], true)
- if(rofl == true) then -- Account gibt es
- guiSetEnabled(LOTab[2], false)
- guiSetSelectedTab(LOTabPanel[1], LOTab[1])
- else -- Account gibt es nicht
- guiSetEnabled(LOTab[1], false)
- guiSetSelectedTab(LOTabPanel[1], LOTab[2])
- end
- end)
- end
- end)
- -- SERVER -- SERVER ASSHOLE! -- SERVEAAAAAAAAAAAAAAAAAAAAAAAAA!!!
- addEvent("onAccountLogin", true)
- addEventHandler("onAccountLogin", getRootElement(),
- function(pw)
- if(client ~= source) then return end
- local query = "SELECT * FROM accounts WHERE NAME = '"..getPlayerName(source).."' AND PASSWORD = '"..md5(pw).."';"
- local result = mysql_query( handler, query )
- if ( result and mysql_num_rows( result ) > 0) then
- triggerClientEvent(source, "onAccountLoginBack", source, true)
- fadeCamera(source, false, 1.0, 255, 255, 255)
- setTimer(fadeCamera, 1500, 1, source, true)
- setTimer(triggerEvent, 1500, 1, "onMultistuntSpawn", source)
- setElementData(source, "ms.eingeloggt", true)
- outputChatBox("Du hast dich erfolgreich Eingeloggt!", source, 0, 255, 0)
- local rowAccount = mysql_fetch_assoc(result)
- --
- -- Account --
- setElementData(source, "ms.adminlevel", rowAccount['ADMINLEVEL'])
- setElementData(source, "ms.money", rowAccount['MONEY'])
- setElementData(source, "ms.playtime", rowAccount['PLAYTIME'])
- setElementData(source, "ms.skin", rowAccount['SKIN'])
- setElementModel(source, getElementData(source, "ms.skin"))
- --
- addEventHandler("onElementDataChange", source,
- function(data)
- if(data == "ms.adminlevel") then
- mysql_query(handler,"UPDATE accounts SET ADMINLEVEL = '"..getElementData(source, data).."' WHERE NAME = '"..getPlayerName(source).."'")
- elseif(data == "ms.money") then
- mysql_query(handler,"UPDATE accounts SET MONEY = '"..getElementData(source, data).."' WHERE NAME = '"..getPlayerName(source).."'")
- setPlayerMoney(source, getElementData(source, data))
- elseif(data == "ms.playtime") then
- mysql_query(handler,"UPDATE accounts SET PLAYTIME = '"..getElementData(source, data).."' WHERE NAME = '"..getPlayerName(source).."'")
- elseif(data == "ms.skin") then
- mysql_query(handler,"UPDATE accounts SET SKIN = '"..getElementData(source, data).."' WHERE NAME = '"..getPlayerName(source).."'")
- end
- end)
- else
- triggerClientEvent(source, "onAccountLoginBack", source, false)
- triggerClientEvent(source, "showLoginCursor", source)
- outputChatBox("Fehler: Der Account Exestiert nicht, oder du hast ein falsches Passwort eingegeben!", source, 255, 0, 0 )
- end
- mysql_free_result(result)
- end)
- addEvent("onLoginDataNeed", true)
- addEventHandler("onLoginDataNeed", getRootElement(),
- function()
- if(client ~= source) then return end
- local query = "SELECT * FROM accounts WHERE NAME = \'"..getPlayerName(source).."\';"
- local result = mysql_query( handler, query )
- if ( result and mysql_num_rows( result ) > 0) then
- triggerClientEvent(source, "onLoginDataNeedBack", source, true)
- else
- triggerClientEvent(source, "onLoginDataNeedBack", source, false)
- end
- mysql_free_result(result)
- end)
- addEvent("onAccountRegister", true)
- addEventHandler("onAccountRegister", getRootElement(),
- function(alter, passwort, geschlecht, land)
- if(client ~= source) then return end
- if(alter) and (passwort) and (geschlecht) and (land) then
- local name = getPlayerName(source)
- local ip = getPlayerIP(source)
- local serial = getPlayerSerial(source)
- local newpasswort = md5(passwort)
- local time = getRealTime()
- local day = time.monthday
- local month = time.month+1
- local year = time.year+1900
- local hour = time.hour
- local minute = time.minute
- local datum = day.."."..month.."."..year.." "..hour..":"..minute
- local query = "INSERT INTO accounts ( NAME, PASSWORD, IP, SERIAL, AGE, GESCHLECHT, LAND, REGISTERDATUM ) VALUES ( '"..name.."', '"..newpasswort.."', '"..ip.."', '"..serial.."', '"..alter.."', '"..geschlecht.."', '"..land.."', '"..datum.."' )"
- local result = mysql_query( handler, query )
- if(result) then
- outputChatBox("Du hast dich erfolgreich Registriert, und kannst dich nun Einloggen!", source, 0, 255, 0, false)
- triggerClientEvent(source, "showLoginCursor", source)
- triggerEvent("onLoginDataNeed", source)
- mysql_free_result(result)
- else
- outputChatBox("Fehler beim Registrieren!", source, 255, 0, 0, false)
- triggerClientEvent(source, "showLoginCursor", source)
- end
- end
- end)
Advertisement
Add Comment
Please, Sign In to add comment