Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function onSubmitLogin(username, password)
- if username and password then
- player = source
- if string.len(username)<2 then
- return exports.rp_notifications:showBox (player,"Twój login musi zawierać minimum 2 znaki!")
- elseif string.len(password)<2 then
- return exports.rp_notifications:showBox (player,"Twoje hasło musi zawierać minimum 2 znaki!")
- end
- callRemote("http://fg.cherro.pl/mtalogin/loginAuth.php", function(bool)
- if bool ~= "ERROR" then
- --tab = fromJSON(bool)
- if bool[1] == true then
- local res = exports.rp_database:pobierzWyniki("SELECT * FROM FG_core_members WHERE name = ?", username)
- if res.bantime == nil or res.bantime < getRealTime().timestamp then
- setElementData(player,"accountID", res.member_id)
- if tonumber(res.premium) == nil or res.premium < getRealTime().timestamp then
- setElementData(player, "premiumPlayer", false)
- else
- setElementData(player, "premiumPlayer", true)
- end
- --setElementData(player, "k:premium", res.premium > getRealTime().timestamp and true or false)
- local ip = getPlayerIP(player)
- local serial = getPlayerSerial(player)
- triggerClientEvent(player,"l:hide",root)
- triggerClientEvent(player,"l:cursor",root)
- exports.rp_logs:addLog(player,"[LOGIN_ACCOUNTS] Logowanie na konto (sukces).")
- setElementData(player, "loggedIn", 1)
- else
- return exports.rp_notifications:showBox(player, "Twoje konto jest zbanowane.")
- end
- elseif bool[1] == false then
- return exports.rp_notifications:showBox(player, string.format("%s", bool[2]))
- else
- return exports.rp_notifications:showBox(player, "Błąd w trakcie logowania. Skontaktuj się z administratorem.")
- end
- else
- return exports.rp_notifications:showBox(source, "Błąd w trakcie logowania. Skontaktuj się z administratorem.")
- end
- end, username, password)
- end
- end
- addEvent("l:trylogin", true)
- addEventHandler("l:trylogin", getRootElement(), onSubmitLogin)
- addEventHandler("onPlayerJoin", root, function()
- setPlayerName(source, string.format("Niezalogowany_%s", string.upper(exports.rp_utils:generateString(5))))
- setElementData(source, "loggedIn", 0)
- end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement