mysql-async v3.0.1 support

This commit is contained in:
ElPumpo
2018-09-24 17:36:50 +02:00
parent 29f64dd928
commit f108cecbbb
+2 -13
View File
@@ -1,5 +1,4 @@
WhiteList = {} WhiteList = {}
local hasSqlRun = false
function loadWhiteList(cb) function loadWhiteList(cb)
Whitelist = {} Whitelist = {}
@@ -9,26 +8,16 @@ function loadWhiteList(cb)
table.insert(WhiteList, tostring(identifiers[i].identifier):lower()) table.insert(WhiteList, tostring(identifiers[i].identifier):lower())
end end
hasSqlRun = true
if cb ~= nil then if cb ~= nil then
cb() cb()
end end
end) end)
end end
AddEventHandler('onMySQLReady', function() MySQL.ready(function()
loadWhiteList() loadWhiteList()
end) end)
Citizen.CreateThread(function()
Citizen.Wait(10000)
if not hasSqlRun then
loadWhiteList()
end
end)
AddEventHandler('playerConnecting', function(name, setCallback, deferrals) AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
-- Mark this connection as deferred, this is to prevent problems while checking player identifiers. -- Mark this connection as deferred, this is to prevent problems while checking player identifiers.
deferrals.defer() deferrals.defer()
@@ -67,4 +56,4 @@ AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
else else
deferrals.done(kickReason) deferrals.done(kickReason)
end end
end) end)