MySQL Updates

This commit is contained in:
Kakarot
2022-05-19 00:52:22 -05:00
parent 7032c471af
commit fbdf566649
2 changed files with 15 additions and 15 deletions
+2 -2
View File
@@ -328,13 +328,13 @@ end
function QBCore.Functions.IsPlayerBanned(source)
local plicense = QBCore.Functions.GetIdentifier(source, 'license')
local result = MySQL.Sync.fetchSingle('SELECT * FROM bans WHERE license = ?', { plicense })
local result = MySQL.single.await('SELECT * FROM bans WHERE license = ?', { plicense })
if not result then return false end
if os.time() < result.expire then
local timeTable = os.date('*t', tonumber(result.expire))
return true, 'You have been banned from the server:\n' .. result.reason .. '\nYour ban expires ' .. timeTable.day .. '/' .. timeTable.month .. '/' .. timeTable.year .. ' ' .. timeTable.hour .. ':' .. timeTable.min .. '\n'
else
MySQL.Async.execute('DELETE FROM bans WHERE id = ?', { result.id })
MySQL.query('DELETE FROM bans WHERE id = ?', { result.id })
end
return false
end