Guest User

accountS.lua

a guest
Nov 6th, 2018
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.39 KB | None | 0 0
  1. -- \\ writed by Jack // --
  2. --Regisztráció
  3. --Bejelentkezés
  4. --Karakter létrehozás random név táblából
  5. --Adatok mentése
  6. --Ellenőrizni hogy a játékosnak van -e accountja, ha van akkor a login-t tesszük elé
  7.  
  8.  
  9. local con = exports.le_mysql:getConnection( )
  10. local player = source;
  11.  
  12. addEvent("checkAccount", true)
  13. addEventHandler("checkAccount", root,
  14.     function()
  15.  
  16.     end
  17. )
  18.  
  19. addEvent("acc:Register")
  20. addEventHandler("acc:Register", root,
  21.     function()
  22.         local serial = getPlayerSerial(source);
  23.         local qh = dbQuery(con, "SELECT * FROM accounts");
  24.         local res = dbPoll(qh, 0);
  25.         triggerClientEvent(source, "sendDatas:server", source, username, password, passwordconfirm, email)
  26.         setTimer(function()
  27.             if (#res > 0) then  
  28.                 if ((username ~= nil) and (password ~= nil) and (passwordconfirm ~= nil) and (email ~= nil)) then
  29.                     dbExec(con, "INSERT INTO accounts SET username = ?, password = ?, email = ?, serial = ?", username, password, email, serial);
  30.                 end
  31.             end
  32.         end, 1000, 1)
  33.     end
  34. )
  35.  
  36. addEvent("acc:Login")
  37. addEventHandler("acc:Login", root,
  38.     function()
  39.    
  40.    
  41.     end
  42. )
  43.  
  44. function player_Spawn()
  45.     triggerClientEvent(source, "cancelMoveCamera", source)
  46.     spawnPlayer(source, 0, 0, 3)
  47. end
  48. addEventHandler("onPlayerLogin", getRootElement(), player_Spawn)
Add Comment
Please, Sign In to add comment