So, I made a function that generates a ban ID. Also, when it generate the id, it checks if the id already exists in the database, if it does, it generates a new one, otherwise it return the id. The issue is that when I call the function, and I print the returned value (so the ban id), it prints nothing.
This is what it prints (nothing)
The following, is the code
RegisterCommand('test-ban-id', function()
print(BanId())
end)
function BanId()
local base3 = math.random(1, 999)
local base5 = math.random(1, 99999)
local result = base3.. "-" ..base5
MySQL.query('SELECT * FROM bannedplayers WHERE banid = ?', {result}, function(results)
if #results > 0 then
BanId()
else
return result
end
end)
end