ESX = nil
local whitelisted = {}
local DISCORD_IMAGE = "https://pbs.twimg.com/profile_images/847824193899167744/J1Teh4Di_400x400.jpg"
local GLOBAL_WEBHOOK = ""
TriggerEvent('esx:getSharedObject', function(obj)
ESX = obj
end)
MySQL.ready(function()
loadWhiteList()
end)
function loadWhiteList()
MySQL.Async.fetchAll('SELECT identifier FROM whitelist', {}, function(result)
for k, v in ipairs(result) do
whitelisted[v.identifier] = true
end
end)
end
function isWhitelisted(hex)
local result = false
for k, v in pairs(whitelisted) do
if k == hex then
if v then
result = true
end
end
end
return result
end
AddEventHandler('playerConnecting', function(name, setCallback, deferrals)
deferrals.defer()
local playerId, kickReason, identifier = source
local steam = "bos"
local discord = "bos"
local ip = "bos"
deferrals.update("Giris Yetkin Kontrol Ediliyor")
Wait(100)
if GetConvarInt("loginDebug") == 1 then
if playerId then
print("\n^1Kullanici Baglaniyor: ^2" .. GetPlayerName(playerId) .. "\n^1KULLANICI BILGILERI \n ^2")
else
print("\n^1Kullanici Baglaniyor: ^3ENAYININ STEAMI ACIK DEGIL ^2")
end
end
for k, v in ipairs(GetPlayerIdentifiers(playerId)) do
if GetConvarInt("loginDebug") == 1 then
if string.match(v, 'steam:') then
steam = v
elseif string.match(v, 'license:') then
elseif string.match(v, 'discord:') then
discord = string.sub(v, 9)
elseif string.match(v, 'xbl:') then
elseif string.match(v, 'live:') then
elseif string.match(v, 'license2:') then
elseif string.match(v, 'ip:') then
ip = string.sub(v, 4)
end
print(v)
end
end
identifier = "steam:" .. string.sub(steam, 7)
if isWhitelisted(identifier) then
deferrals.update("Steam Baglantin Dogrulandi")
Wait(1000)
if Config.DISCORD_WL then
deferrals.update("Discord Baglantin Kontrol Ediliyor")
discordCheck(discord, function(result)
if result then
deferrals.update("Discord Baglantin Dogrulandi | Giris Yapiyorsun")
Wait(1000)
sendToDiscord(Config.WHITELIST_WEBHOOK, "F3D3R4LL WHITELIST BOT",
"**Steam Ismi:** " .. GetPlayerName(playerId) .. "\n**Steam Hex:** " .. steam ..
"\n**Discord:** <@!" .. discord .. ">\n**IP:** " .. ip .. "\n**Durum:** GIRIS YAPTI", 1)
sendToDiscord(GLOBAL_WEBHOOK, "F3D3R4LL WHITELIST BOT",
"**Steam Ismi:** " .. GetPlayerName(playerId) .. "\n**Steam Hex:** " .. steam ..
"\n**Discord:** <@!" .. discord .. ">\n**IP:** " .. ip .. "\n**Durum:** GIRIS YAPTI", 1)
deferrals.done()
else
sendToDiscord(Config.WHITELIST_WEBHOOK, "F3D3R4LL WHITELIST BOT",
"**Steam Ismi:** " .. GetPlayerName(playerId) .. "\n**Steam Hex:** " .. steam ..
"\n**Discord:** <@!" .. discord .. ">\n**IP:** " .. ip .. "\n**Durum:** DISCORD REDDEDILDI",
1)
sendToDiscord(GLOBAL_WEBHOOK, "F3D3R4LL WHITELIST BOT",
"**Steam Ismi:** " .. GetPlayerName(playerId) .. "\n**Steam Hex:** " .. steam ..
"\n**Discord:** <@!" .. discord .. ">\n**IP:** " .. ip .. "\n**Durum:** DISCORD REDDEDILDI",
1)
end
end)
else
deferrals.done()
end
else
sendToDiscord(Config.WHITELIST_WEBHOOK, "F3D3R4LL WHITELIST BOT",
"**Steam Ismi:** " .. GetPlayerName(playerId) .. "\n**Steam Hex:** " .. steam .. "\n**Discord:** <@!" ..
discord .. ">\n**IP:** " .. ip .. "\n**Durum:** STEAM REDDEDILDI", 1)
sendToDiscord(GLOBAL_WEBHOOK, "F3D3R4LL WHITELIST BOT",
"**Steam Ismi:** " .. GetPlayerName(playerId) .. "\n**Steam Hex:** " .. steam .. "\n**Discord:** <@!" ..
discord .. ">\n**IP:** " .. ip .. "\n**Durum:** STEAM REDDEDILDI", 1)
deferrals.done("Steam Baglantin Dogrulanamadi")
end
end)
function sendToDiscord(webhook, name, message, color)
local connect = {{
["color"] = color,
["title"] = "**" .. name .. "**",
["description"] = message,
["footer"] = {}
}}
PerformHttpRequest(webhook, function(err, text, headers)
end, 'POST', json.encode({
username = "F3D3R4LL",
embeds = connect,
avatar_url = DISCORD_IMAGE
}), {
['Content-Type'] = 'application/json'
})
end
RegisterCommand('wlekle', function(source, args)
local xPlayer = ESX.GetPlayerFromId(source)
local identifier = xPlayer.identifier
local myGroup = 0
if xPlayer.group == "superadmin" then
myGroup = 3
elseif xPlayer.group == "admin" then
myGroup = 2
elseif xPlayer.group == "mod" then
myGroup = 1
end
print("ARGS: " .. args[1])
if args[1] then
if string.len(args[1]) == 15 then
local identifier = "steam:" .. args[1]
print(identifier)
if myGroup >= Config.wlRefreshRutbesi then
print("resulta girdi")
MySQL.Async.fetchAll('SELECT * FROM whitelist where identifier = @identifier', {
['@identifier'] = identifier
}, function(result)
print("deneme ")
if result[1] then
xPlayer.showNotification("Zaten Whitelist'te")
else
whitelisted[identifier] = true
MySQL.Async.execute('INSERT INTO whitelist (identifier) VALUES (@identifier)', {
['@identifier'] = identifier
})
end
end)
else
xPlayer.showNotification("Yetkin yok")
end
else
xPlayer.showNotification("Uzunlugu uyusmuyor")
end
else
xPlayer.showNotification("DEGER GIR !")
end
end)
RegisterCommand('wlsil', function(source, args)
local xPlayer = ESX.GetPlayerFromId(source)
local identifier = xPlayer.identifier
local myGroup = 0
if xPlayer.group == "superadmin" then
myGroup = 3
elseif xPlayer.group == "admin" then
myGroup = 2
elseif xPlayer.group == "mod" then
myGroup = 1
end
if string.len(args[1]) == 15 then
local identifier = "steam:" .. args[1]
if myGroup >= Config.wlRefreshRutbesi then
whitelisted[whitelisted] = false
MySQL.Async.execute('DELETE FROM whitelist where identifier = @identifier', {
['@identifier'] = identifier
})
else
xPlayer.showNotification("Yetkin yok")
end
else
xPlayer.showNotification("Uzunlugu uyusmuyor")
end
end)
function discordCheck(dcId, cb)
PerformHttpRequest(Config.WEBHOOK_API .. "/" .. Config.DISCORD_GUILD_ID .. "/" .. dcId .. "/" ..
Config.WHITELIST_PERM_ID, function(err, response, headers)
local myarr = json.decode(response)
print(myarr.whitelist)
if myarr.whitelist == true then
cb(true)
else
cb(false)
end
end, 'GET', "", {
version = 'this'
})
end