mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
chore: initial commit
This commit is contained in:
@@ -0,0 +1,42 @@
|
||||
WhiteList = {}
|
||||
|
||||
function loadWhiteList ()
|
||||
MySQL.Async.fetchAll(
|
||||
'SELECT * FROM whitelist',
|
||||
{},
|
||||
function (identifiers)
|
||||
for i=1, #identifiers, 1 do
|
||||
table.insert(WhiteList, tostring(identifiers[i].identifier))
|
||||
end
|
||||
end
|
||||
)
|
||||
end
|
||||
|
||||
MySQL.ready(function ()
|
||||
loadWhiteList()
|
||||
end)
|
||||
|
||||
AddEventHandler('playerConnecting', function (playerName, setKickReason)
|
||||
if (WhiteList == {}) then
|
||||
Citizen.Wait(1000)
|
||||
end
|
||||
|
||||
local whitelisted = false
|
||||
local steamID = GetPlayerIdentifiers(source)[1] or false
|
||||
|
||||
if steamID == false then
|
||||
setKickReason(_U('steamid_error'))
|
||||
CancelEvent()
|
||||
end
|
||||
|
||||
for i = 1, #WhiteList, 1 do
|
||||
if (tostring(WhiteList[i]) == tostring(steamID)) then
|
||||
whitelisted = true
|
||||
end
|
||||
end
|
||||
|
||||
if whitelisted == false then
|
||||
setKickReason(_U('not_whitelisted'))
|
||||
CancelEvent()
|
||||
end
|
||||
end)
|
||||
Reference in New Issue
Block a user