mirror of
https://github.com/qbcore-fivem/qb-core.git
synced 2026-08-29 01:08:57 +00:00
fix ban function always returns false
global variables where not writable from inside the export function for some reason
This commit is contained in:
+11
-11
@@ -245,17 +245,17 @@ end
|
||||
QBCore.Functions.IsPlayerBanned = function (source)
|
||||
local retval = false
|
||||
local message = ""
|
||||
exports['ghmattimysql']:execute('SELECT * FROM bans WHERE license=@license', {['@license'] = QBCore.Functions.GetIdentifier(source, 'license')}, function(result)
|
||||
if result[1] ~= nil then
|
||||
if os.time() < result[1].expire then
|
||||
retval = true
|
||||
local timeTable = os.date("*t", tonumber(result[1].expire))
|
||||
message = "You have been banned from the server:\n"..result[1].reason.."\nYour ban expires "..timeTable.day.. "/" .. timeTable.month .. "/" .. timeTable.year .. " " .. timeTable.hour.. ":" .. timeTable.min .. "\n"
|
||||
else
|
||||
exports['ghmattimysql']:execute('DELETE FROM bans WHERE id=@id', {['@id'] = result[1].id})
|
||||
end
|
||||
end
|
||||
end)
|
||||
local result = exports.ghmattimysql:executeSync('SELECT * FROM bans WHERE license=@license', {['@license'] = QBCore.Functions.GetIdentifier(source, 'license')})[1]
|
||||
|
||||
if result ~= nil then
|
||||
if os.time() < result.expire then
|
||||
retval = true
|
||||
local timeTable = os.date("*t", tonumber(result.expire))
|
||||
message = "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
|
||||
exports['ghmattimysql']:execute('DELETE FROM bans WHERE id=@id', {['@id'] = result.id})
|
||||
end
|
||||
end
|
||||
return retval, message
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user