Exports
Server-Side Exports
This page has all available exports on server-side
Replace "anticheat-name" with the folder name of your FiveGuard resource.
#Ban Export
exports["anticheat-name"]:BanPlayer( playerSource --[[ integer ]], violation --[[ string ]], send_to_logs --[[ boolean ]])Parameters:
playerSource: The player handleviolation: The reason the player is banned forsend_to_logs: whether to send ban log on Webhook Ban Logs#Example Code
RegisterNetEvent("clientban")AddEventHandler("clientban", function(violation) exports["anticheat-name"]:BanPlayer(source, violation, true)end)#Unban Export
local result --[[ object ]] = exports["anticheat-name"]:UnbanId( BanId --[[ integer ]] )Parameters:
BanId: The Ban Id to unbanReturns:
object that contains name from ban object OR false if the Ban Id does not exist.#Get Ban Info Id Export
local result --[[ object ]] = exports["anticheat-name"]:GetBanInfoId( BanId --[[ integer ]] )Parameters:
BanId: The Ban Id to get infoReturns:
ban object OR false if the Ban Id does not exist.#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 a permission that is already assigned to the player in ACE System or Alternative Permissions
A Temp Permission won't be sent to a player who is not fully loaded yet, or whose client has not finished loading FiveGuard
All possible categories and permissions are listed in Ace Permissions
Parameters:
playerSource: The player handlecategory: Permission Category (example: Client or AdminMenu)permission: Permission (example: AdminMenuAccess for AdminMenu or BypassSuperJump for Client)allow: true or false | default: falseignoreStaticPermission: ignores static permission (setting it on true will ignore permissions already made in ace or alternative permissions)Returns:
true if permission was set successfully and errorText as nil, if not then false and errorText will contain the error message#Has Temp Permission Export
local result --[[ boolean ]] = exports["anticheat-name"]:HasTempPermission( playerSource --[[ integer ]], category --[[ string ]], permission --[[ string ]] )Parameters:
playerSource: The player handlecategory: Permission Category (example: Client or AdminMenu)permission: Permission (example: AdminMenuAccess for AdminMenu or BypassSuperJump for Client)Returns:
true if the player currently has this temp permission, otherwise false#Example Code
if not exports["anticheat-name"]:HasTempPermission(source, "Client", "BypassFreecam") then exports["anticheat-name"]:SetTempPermission(source, "Client", "BypassFreecam", true, false)end#Record Player Screen Export
exports["anticheat-name"]:recordPlayerScreen( playerSource --[[ integer ]], time --[[ integer ]], handler --[[ func ]], custom_url --[[ string ]] )Parameters:
playerSource: The player handletime: How long will video take (in milliseconds)handler: function and it will return url in first parametercustom_url: url where video will be sent (leave empty if fiveguard should use Screenshot Storage Webhook)Returns:
url in handler first parametererror in handler second parameter (nil if there is no error)#Example Code
RegisterCommand("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 handlehandler: function and it will return url in first parametercustom_url: url where screenshot will be sent (leave empty if fiveguard should use Screenshot Storage Webhook)Returns:
url in handler first parametererror in handler second parameter (nil if there is no error)#Refresh Player Permissions Export
exports["anticheat-name"]:RefreshPlayerPermissions( playerSource --[[ integer ]] )Parameters:
playerSource: The player handleReturns:
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 Systemconfig: 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 exportReturns:
true if event has been registered successfully 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 handleReturns:
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 EventRegisterNetEvent("taxi:pay")AddEventHandler("taxi:pay", function(money) local source = source if not exports[fiveguard_resource]:VerifyToken(source) then return end -- rest of instructionsend)#Get Player Trust Score Export
local result --[[ object ]] = exports["anticheat-name"]:GetPlayerTrustScore( playerSource --[[ integer ]] )Parameters:
playerSource: The player handleReturns:
object with the player's trust score:score: numberreasons: array of strings explaining the scorenil if the player does not exist or their trust score is not ready yet#Example Code
local trust = exports["anticheat-name"]:GetPlayerTrustScore(source)if not trust then return print("Trust score not available yet")endprint("Trust score: " .. trust.score)for _, reason in ipairs(trust.reasons) do print(" - " .. reason)end#Get Version Export
local version --[[ string ]] = exports["anticheat-name"]:GetVersion()Returns:
the current version of FiveGuard#Example Code
print("FiveGuard version: " .. exports["anticheat-name"]:GetVersion())