daily pastebin goal
17%
SHARE
TWEET

Untitled

a guest Dec 23rd, 2017 27 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. addEvent("registerRequest",true)
  2. function registerRequest(player,username,password,email)
  3.     local acount = getAccount(username)
  4.     if acount == false then
  5.         local ip = getPlayerIP(player)
  6.         local serial = getPlayerSerial(player)
  7.         exports.mysql:_Exec("insert into accounts(username,password,email,ip,serial) values (?,?,?,?,?)",username,password,email,ip,serial)
  8.         local addAccount = addAccount(tostring(username),tostring(password))
  9.         if addAccount then
  10.             outputDebugString("User register with username ".. username)
  11.         else
  12.             outputDebugString("ERROR Occur while register.")
  13.         end
  14.     end
  15. end
  16. addEventHandler("registerRequest",getRootElement(),registerRequest)
  17.  
  18. addEvent("loginRequest",true)
  19. function loginRequest(player,username,password)
  20.     local check = exports.mysql:_QuerySingle("select * from accounts where username = ? ",username)
  21.     if check then
  22.         local checkPass = check.password
  23.         if (checkPass == password) then
  24.             logIn(player,getAccount(username),tostring(password))
  25.             triggerClientEvent(player,"showHide",getRootElement())
  26.             outputDebugString("User Logged In")
  27.             spawnPlayer ( player, 0, 0, 3 )
  28.             fadeCamera(player, true)
  29.             setCameraTarget(player, player)
  30.             addEventHandler ( "onPlayerQuit", getRootElement(), quitPlayer )
  31.         end
  32.     end
  33. end
  34. addEventHandler("loginRequest",getRootElement(),loginRequest)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top