Advertisement
Guest User

Untitled

a guest
Apr 1st, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.85 KB | None | 0 0
  1. addEventHandler('account -> loginAccount', getRootElement(), function(thePlayer, username, password)
  2. if client then
  3. if source ~= thePlayer then
  4. outputDebugString('[TRIGGER] TRIGGER CANCELLED: '.. tostring(client) ..' | RESOURCE: '.. getResourceName(getThisResource()))
  5. return
  6. end
  7.  
  8. if thePlayer ~= client then
  9. outputDebugString('[TRIGGER] TRIGGER CANCELLED: '.. tostring(client) ..' | RESOURCE: '.. getResourceName(getThisResource()))
  10. return
  11. end
  12. end
  13.  
  14. local password = md5(sha256(md5(passwordHash .. password)))
  15. local serial = getPlayerSerial(thePlayer)
  16.  
  17. dbExec(dbConn, 'UPDATE accounts SET banned = 0 WHERE username = ? AND ban_expiry<NOW()', username)
  18.  
  19. dbQuery( function(qh)
  20. local result, num, id = dbPoll(qh, 0)
  21.  
  22. if num > 0 then
  23. if result then
  24. for i, v in ipairs(result) do
  25. if v['serial'] ~= getPlayerSerial(thePlayer) then
  26. exports['_cPopup']:createNotification(thePlayer, 'error', 'A felhasználó nem a te gépedhez van társítva!')
  27. return
  28. end
  29.  
  30. if v['password'] ~= password then
  31. exports['_cPopup']:createNotification(thePlayer, 'error', 'Hibás jelszó!')
  32. return
  33. end
  34.  
  35. if v['banned'] == 1 then
  36. exports['_cPopup']:createNotification(thePlayer, 'error', 'Kilettél tiltva a szerverről! [ID: '.. v['id'] ..']')
  37. return
  38. end
  39. exports['_cPopup']:createNotification(thePlayer, 'success', 'Sikeresen bejelentkeztél a szerverre!')
  40. triggerClientEvent(thePlayer, 'account -> sendAccountTableToClient', thePlayer, v['username'], v['email'], v['regDate'], v['id'])
  41. setElementData(thePlayer, 'admin -> level', v['adminLevel'])
  42. end
  43. end
  44. else
  45. exports['_cPopup']:createNotification(thePlayer, 'error', 'Nincs ilyen felhasználó az adatbázisban!')
  46. end
  47. end, dbConn, 'SELECT * FROM accounts WHERE username = ?', username)
  48. end)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement