chore: initial commit

This commit is contained in:
Romain Lanz
2017-09-14 22:58:01 +02:00
commit e544c17fb3
9 changed files with 783 additions and 0 deletions
+42
View File
@@ -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)