usernames = {}
function onLogin ( player, user, pass )
local account = getAccount ( user, pass )
local accblock = accountBlocked(user)
if ( account ~= false ) then
if accblock == "0" then return end
outputChatBox(accblock)
if isTimer(cooldown) then return end
cooldown = setTimer(function() end, 1000, 1)
if (logIn ( client, account, pass ) == true) then
triggerClientEvent ( client, "SAEGLogin:hideLogin", client )
setElementData(player,"AccountData:Username",tostring(user))
setElementData ( player, "AccountData:Serial", s )
setElementData ( player, "AccountData:IP", ip )
else
triggerClientEvent ( client, "setWarning", client, "Something went wrong while logging!", 255, 0, 0 )
end
else
triggerClientEvent ( client, "setWarning", client, "Invalid login details!", 255, 0, 0 )
end
end
addEvent( "SAEGLogin:onLogin", true )
addEventHandler( "SAEGLogin:onLogin", root, onLogin )
function accountBlocked(acc)
accblocked = false
query = exports.NGsql:db_query ( "SELECT * FROM accountdata WHERE Username=? LIMIT 1", tostring(acc))
for i, v in ipairs (query) do
accblocked = v["Blocked"]
end
if not accblocked then return false end
return accblocked
end
what's worng with my code guys ?? pff the player can login if the account is blocked