Guest User

Untitled

a guest
Mar 19th, 2021
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.96 KB | None | 0 0
  1. local db = exports['rpg_db']
  2.  
  3. addEvent('login', true)
  4. addEventHandler('login', root, function(login, pass)
  5.     local res = db:query(string.format("SELECT * FROM authorize WHERE login=%s", login))
  6.     if not res or #res<1 then
  7.         outputChatBox('takie konto nie istnieje')
  8.         return
  9.     end
  10.     if res[1].login == 0 then
  11.         outputChatBox('takie konto nie istnieje')
  12.         return
  13.     end
  14.     if res[1].pass ~= pass then
  15.         outputChatBox('zle haslo')
  16.         return
  17.     end
  18.     setElementData(client, "player:dbid", res[1].dbid)
  19. end)
  20.  
  21. addEvent('new', true)
  22. addEventHandler('new', root, function(login, pass)
  23.     local res = db:query(string.format('SELECT * FROM authorize WHERE login=%s', login))
  24.     if res and #res>0 then
  25.         outputChatBox('takie konto juz jest')
  26.         return
  27.     end
  28.     db:execute(string.format('INSERT INTO authorize (login,pass) VALUES (%s, %s)', login, pass))
  29.     outputChatBox('zrobiles konto')
  30. end)
Advertisement
Add Comment
Please, Sign In to add comment