Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local db = exports['rpg_db']
- addEvent('login', true)
- addEventHandler('login', root, function(login, pass)
- local res = db:query(string.format("SELECT * FROM authorize WHERE login=%s", login))
- if not res or #res<1 then
- outputChatBox('takie konto nie istnieje')
- return
- end
- if res[1].login == 0 then
- outputChatBox('takie konto nie istnieje')
- return
- end
- if res[1].pass ~= pass then
- outputChatBox('zle haslo')
- return
- end
- setElementData(client, "player:dbid", res[1].dbid)
- end)
- addEvent('new', true)
- addEventHandler('new', root, function(login, pass)
- local res = db:query(string.format('SELECT * FROM authorize WHERE login=%s', login))
- if res and #res>0 then
- outputChatBox('takie konto juz jest')
- return
- end
- db:execute(string.format('INSERT INTO authorize (login,pass) VALUES (%s, %s)', login, pass))
- outputChatBox('zrobiles konto')
- end)
Advertisement
Add Comment
Please, Sign In to add comment