addEvent("addAccount", true) addEventHandler("addAccount", resourceRoot, function(player, nick, haslo, email) if not nick or not haslo or not email then return end nick = string.gsub(nick, " ", "") haslo = string.gsub(haslo, " ", "") email = string.gsub(email, ' ', ''); local result = database:getDB("select * from pystories_users where login=? LIMIT 1", nick) if result and #result > 0 then noti:alert(player, 'error', 'Ten login jest już zajęty przez kogoś.'); return end local result = database:getDB('select * from pystories_users where email=? limit 1', email); if result and #result > 0 then noti:alert(player, 'error', 'Ten adres E-Mail jest już zajęty.'); return end local result = database:getDB("select * from pystories_users where register_serial=? LIMIT 1", getPlayerSerial(player)) if result and #result >= 999 then noti:alert(player, 'error', 'Na dany serial przypada tylko jedno konto.'); return end passwordHash(haslo, "bcrypt", {}, function(pass) local query, _, sid = database:setDB("insert into pystories_users (login, pass, changedpw, register_serial) values (?, ?, ?, ?)", nick, pass, 1, getPlayerSerial(player)) if(query)then noti:alert(player, 'success', 'Pomyślnie utworzono konto.'); else noti:alert(player, 'error', 'Wystąpił błąd podczas rejestracji. Kod błędu #001.'); end end) end)