Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function registerPlayer(user, Senha, conf)
- if user == "" then
- outputLoginMsg(source, "Preencha todos os campos!", "error")
- else
- if Senha == "" then
- outputLoginMsg(source, "Preencha todos os campos!", "error")
- else
- if conf == "" then
- outputLoginMsg(source, "Preencha todos os campos!", "error")
- else
- if conf == Senha then
- addAccount(tostring(user),tostring(Senha))
- triggerClientEvent(source, "onRoyalRegister", source)
- local time = getRealTime()
- local days = tonumber(time.monthday)
- local months = tonumber(time.month)
- local years = tonumber(time.year)
- local Serial = getPlayerSerial(source)
- local query = db:query("SELECT * FROM RoyalLifeUsers WHERE Usuario=? LIMIT 1", user)
- local userCode = math.random(0,9)..""..math.random(0,9)..""..math.random(0,9)..""..math.random(0,9)
- local codeVerify = db:query("SELECT * FROM RoyalLifeUsers WHERE Codigo=?", userCode)
- if #query == 0 then
- while #codeVerify == 0 then
- local userCode = math.random(0,9)..""..math.random(0,9)..""..math.random(0,9)..""..math.random(0,9)
- local codeVerify = db:query("SELECT * FROM RoyalLifeUsers WHERE Codigo=?", userCode)
- db:exec("INSERT INTO RoyalLifeUsers VALUES (?, ?, ?, ?, ?, ?, ?)", countIDs(), getPlayerName(source):gsub("#%x%x%x%x%x%x", ""), user, Senha, days.."/"..months+(1).."/"..years-(100), Serial, userCode)
- outputDebugString("Código da conta \""..user.."\", foram gravados em nosso banco de dados.", 0, 16, 102, 231)
- outputDebugString("Código da conta \""..user.."\", foi gerado ("..userCode..")"!", 0, 255, 255, 255)
- end
- end
- outputLoginMsg(source, "Conta criada com sucesso! Aguarde...", "success")
- if not getAccount(user, Senha) then
- outputLoginMsg(source, "Esta conta já está sendo utilizada!", "error")
- end
- else
- outputLoginMsg(source, "As senhas não estão iguais.", "error")
- end
- end
- end
- end
- end
- addEvent("onPlayerRequestRegister", true)
- addEventHandler("onPlayerRequestRegister", root, registerPlayer)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement