Exports
Ban, unban, kick and control Codeon Shield from your own resources.
Every export is server-side. Call them from any server script with exports.CodeonShield:Name(...).
| Export | Returns | What it does |
|---|---|---|
BanPlayer(src, reason, _, staff) | banId | Bans an online player permanently (identifiers and hardware tokens) and kicks them. |
OfflineBan(identifiers, reason, staff, name) | banId | Bans a player who is not connected. identifiers is one identifier ("license:...") or a list. Known identifiers of that player are added too. |
UnbanId(banId) | boolean | Revokes a ban by its ID. |
UnbanIdentifier(identifier) | number | Revokes every ban that contains that identifier. Returns how many were removed. |
IsBanned(src) | boolean | Whether a player matches an active ban. |
GetPlayerBan(src) | table | nil | The ban that matches a player (id, name, reason, staff, date, identifiers, detection, details). |
GetBan(banId) | table | nil | A ban by its ID. |
GetBans() | table | Every active ban. |
KickPlayer(src, reason) | boolean | Kicks a player with the Codeon Shield message. |
Screenshot(src, function(image) end) | boolean | Takes a screenshot of the player's screen. image is a base64 JPEG, or nil if the player did not answer. |
Detect(src, detection, details) | boolean | Bans a player for a detection of your own resource, with the same evidence and webhooks as the anticheat. detection is a key like "anti_noclip". |
AllowTeleport(src, ms) | - | Call it right before your script teleports a player, so teleport and noclip detections ignore it (8 s by default). |
AllowHeal(src, ms) | - | Call it right before your script heals or revives a player (8 s by default). |
AllowWeapon(src, ms) | - | Call it when your script gives a weapon outside the inventory, so Anti Weapon Spawn ignores it (60 s by default). |
Exempt(src, detections, ms) | boolean | Pauses one detection ("anti_noclip"), a list, or all of them (nil) for a player for some milliseconds (10 minutes at most). |
IsStaff(src) | boolean | Whether the player is staff in your Codeon Shield permissions. |
HasPermission(src, action) | boolean | Whether the player can use an action: kick, ban, unban, screenshot or bypass. |
IsDetectionEnabled(detection) | boolean | Whether a detection is enabled in your configuration. |
GetDetections() | table | Every detection with its name and whether it is enabled. |
IsAuthenticated() | boolean | Whether the license is valid and the protection is running. |
Examples
local banId = exports.CodeonShield:BanPlayer(source, "Dupe glitch", nil, "MyScript")
exports.CodeonShield:OfflineBan("license:2b8f1c0e...", "Chargeback")
if exports.CodeonShield:IsBanned(source) then
local ban = exports.CodeonShield:GetPlayerBan(source)
print(ban.id, ban.reason)
end
exports.CodeonShield:AllowTeleport(source)
SetEntityCoords(GetPlayerPed(source), 215.0, -810.0, 30.7)
exports.CodeonShield:Screenshot(source, function(image)
if image then print("Screenshot taken") end
end)
Teleports, heals and revives
Teleports and heals done by txAdmin, the /bring command of ESX and QBCore (only for players with that command's permission), the qb-adminmenu bring and the teleport and revive events of ESX and QBCore are recognised automatically. If your own scripts teleport, heal or give weapons, call AllowTeleport, AllowHeal or AllowWeapon right before, or the anticheat will treat it as a cheat.