Full View config.server.lua

Preview File Updated: v1.0.1 - 11.11.2023

SV = {}

SV.Webhooks = {
    -- "SCREENSHOT" WEBHOOK is used on client-side for screenshot-basic upload - recommended to using other non-used webhook for that.
    ['SCREENSHOT'] = "https://discord.com/api/webhooks/1105477753639284736/H_h3kWC4p9dBPQDpf9Burqlf1H9jxmm8IwkMIrg9eaD_8pkfAqt6OXeYjJbRgI_CimBg",
    
    ['NEW_REPORT'] = "https://discord.com/api/webhooks/1105477753639284736/H_h3kWC4p9dBPQDpf9Burqlf1H9jxmm8IwkMIrg9eaD_8pkfAqt6OXeYjJbRgI_CimBg",
    ['CLOSE_REPORT'] = "https://discord.com/api/webhooks/1105477753639284736/H_h3kWC4p9dBPQDpf9Burqlf1H9jxmm8IwkMIrg9eaD_8pkfAqt6OXeYjJbRgI_CimBg",
}

SV.WebhookText = {
    ['TITLE.NEW_REPORT'] = "🚩 New Report",
    ['DESCRIPTION.NEW_REPORT'] = "**Report ID:** %s\n**Report Creator:** %s\n\n**Type:** %s\n**Title:** %s\n**Description:** %s",

    ['TITLE.CLOSE_REPORT'] = "❌ Close Report",
    ['DESCRIPTION.CLOSE_REPORT'] = "**Report ID:** %s\n**Report Creator:** %s (%s)\n\n**Type:** %s\n**Title:** %s\n**Description:** %s\n\n**Claimed By:** %s (%s)\n**Closed By:** %s (%s)",
    
}

SV.Webhook = function(webhook_id, title, description, image, color, footer)
    local DiscordWebHook = SV.Webhooks[webhook_id]
    local embeds = {{
        ["title"] = title,
        ["type"] = "rich",
        ["description"] = description,
        ["color"] = color,
        ["image"] = {url = image},
        ["footer"] = {
            ["text"] = footer..' - '..os.date(),
        },
    }}
    PerformHttpRequest(DiscordWebHook, function(err, text, headers) end, 'POST', json.encode({embeds = embeds}), {['Content-Type'] = 'application/json'})
end

SV.getIdentifier = function(xPlayer)
    if Config.Core == "ESX" then
        return xPlayer.identifier
    elseif Config.Core == "QB-Core" then
        return xPlayer.PlayerData.citizenid
    end
end

SV.getPlayerByIdentifier = function(identifier)
    if Config.Core == "ESX" then
        return Core.GetPlayerFromIdentifier(identifier)
    elseif Config.Core == "QB-Core" then
        return Core.Functions.GetPlayerByCitizenId(identifier)
    end
end

SV.getCharacterName = function(xPlayer)
    if Config.Core == "ESX" then
        return xPlayer.getName()
    elseif Config.Core == "QB-Core" then
        return xPlayer.PlayerData.charinfo.firstname..' '..xPlayer.PlayerData.charinfo.lastname
    end
end

SV.checkIsAdmin = function(xPlayer)
    if Config.Core == "ESX" then
        return xPlayer.group
    elseif Config.Core == "QB-Core" then
        return Core.Functions.GetPermission(xPlayer.PlayerData.source)
    end
end

SV.banPlayer = function(xAdmin, xTarget)
    if Config.Core == "ESX" then

    elseif Config.Core == "QB-Core" then
        
    end
end

SV.getInventory = function(xPlayer)
    if Config.Core == "ESX" then
        return xPlayer.getInventory(), xPlayer.getLoadout(), xPlayer.getAccounts()
    elseif Config.Core == "QB-Core" then
        return xPlayer.PlayerData.items, nil, xPlayer.PlayerData.money
    end
end

SV.kickPlayer = function(xAdmin, xTarget)
    if Config.Core == "ESX" then
        DropPlayer(xTarget.source, "You has been kicked from the server by @"..GetPlayerName(xAdmin.source))
    elseif Config.Core == "QB-Core" then
        DropPlayer(xTarget.PlayerData.source, "You has been kicked from the server by @"..GetPlayerName(xAdmin.PlayerData.source))
    end
end

Last updated