Server-Side Exports

This page has all available exports on server-side

Ban Export

exports["anticheat-name"]:fg_BanPlayer(
    playerSource --[[ integer ]],
    violation --[[ string ]],
    send_to_logs --[[ boolean ]]
)

Parameters:

playerSource: The player handle
violation: The reason for what player will get ban
send_to_logs: whether to send ban log on Webhook Ban Logs

Example Code

RegisterNetEvent("clientban")
AddEventHandler("clientban", function(violation)
    exports["anticheat-name"]:fg_BanPlayer(source, violation, true)
end)

Unban Export

local result --[[ object ]] =
    exports["anticheat-name"]:UnbanId(
        BanId --[[ integer ]]
    )

Parameters:

BanId: The Ban Id to unban

Returns:

object that contains name from ban object OR false if ban Id does not exists.

Get Ban Info Id Export

local result --[[ object ]] =
    exports["anticheat-name"]:GetBanInfoId(
        BanId --[[ integer ]]
    )

Parameters:

BanId: The Ban Id to get info

Returns:

ban object OR false if ban Id does not exists.

Set Temp Permission Export

local result --[[ boolean ]], errorText --[[ string ]] =
    exports["anticheat-name"]:SetTempPermission(
        playerSource --[[ integer ]],
        category --[[ string ]],
        permission --[[ string ]],
        allow --[[ boolean ]],
        ignoreStaticPermission --[[ boolean ]]
    )

Static Permission - means permissions that are already signed to the player in ACE System or Alternative Permissions

All possible categories and permissions All Possible Permissions

Parameters:

playerSource: The player handle
category: Permission Category (example: Client or AdminMenu)
permission: Permission (example: AdminMenuAccess for AdminMenu or BypassSuperJump for Client)
allow: true or false | default: false
ignoreStaticPermission: ignores static permission (setting it on true will ignore permissions already made in ace or alternative permissions)

Returns:

true if permission was set successfuly and errorText as nil, if not then false and errrorText will contain the error message

record Player Screen Export

exports["anticheat-name"]:recordPlayerScreen(
        playerSource --[[ integer ]],
        time --[[ integer ]],
        handler --[[ func ]],
        custom_url -- [[ string ]]
    )

Parameters:

playerSource: The player handle
time: How long will video take (in milliseconds)
handler: function and it will return url in first parameter
custom_url: url where video will be sent (leave empty if fiveguard should use Screenshot Storage Webhook)

Returns:

url in handler first parameter
error in handler second parameter (nil if there is no error)

Example Code

RegisterCommnad("player_record", function(source, args, rawCommand)
    exports["anticheat-name"]:recordPlayerScreen(args[1], 3000, function(url, err)
        if err then
            return print("failed to take video: "..err)
        end
        print("recorded video: "..url)
    end)
end, true)

screenshot Player Export

exports["anticheat-name"]:screenshotPlayer(
        playerSource --[[ integer ]],
        handler --[[ func ]],
        custom_url -- [[ string ]]
    )

Parameters:

playerSource: The player handle
handler: function and it will return url in first parameter
custom_url: url where screenshot will be sent (leave empty if fiveguard should use Screenshot Storage Webhook)

Returns:

url in handler first parameter
error in handler second parameter (nil if there is no error)

Refresh Player Permissions Export

exports["anticheat-name"]:RefreshPlayerPermissions(
        playerSource --[[ integer ]]
    )

Parameters:

playerSource: The player handle

Returns:

void

Register Safe Event (Safe Events System)

local retval --[[ boolean ]], errorText --[[ string ]] =
    exports["anticheat-name"]:RegisterSafeEvent(
        EventName --[[ string ]],
        config --[[ object ]],
        cross_scripts --[[ boolean ]]
    )

Parameters:

EventName: the event name that should be protected by Safe-Events System
config: the config to specify if Safe-Events System should ban (and log) or just log { log = true, ban = true }
cross_scripts: if true then all resources can use specific event through ExecuteServerEvent export

Returns:

true if event has been registered successfuly and errorText as nil, if not then false and errorText will contain the error message

Verify Token (Safe Events System)

local result --[[ boolean ]] = 
    exports["anticheat-name"]:VerifyToken(
        playerSource --[[ integer ]]
    )

Parameters:

playerSource: The player handle

Returns:

true if player sent good token to server

Example Of Code

--[[
local allEvents = {
    ["taxi:pay"] = false
}
local fiveguard_resource = ""
AddEventHandler("fg:ExportsLoaded", function(fiveguard_res, res)....
]]
-- Code for registering Safe Event

RegisterNetEvent("taxi:pay")
AddEventHandler("taxi:pay", function(money)
    local source = source
    if not exports[fiveguard_resource]:VerifyToken(source) then return end
    -- rest of instructions
end)

Last updated