Get a license

For developers

Exports and hooks

Call APIAC from your own resources: ban and check players on the server, and tell the anti-cheat when your script does something on purpose.

Before you start

  • Call everything with exports.APIAC:name(...).
  • Server exports show up a few seconds after the server starts, once the license is verified.
  • source is always the server ID of an online player.

Server exports

banPlayerServer
exports.APIAC:banPlayer(source, reason, details, days)
Bans an online player. Leave out days to use the ban duration from the panel, or pass 0 for a permanent ban. details is an optional table for the logs.

Returns true when the player was banned

exports.APIAC:kickPlayer(source, reason, details)
Kicks a player and logs it like APIAC's own kicks.

Returns true when the player was kicked

exports.APIAC:unbanPlayer(banId, unbannedBy)
Lifts a ban by the ID players see on the ban screen. unbannedBy is a name for the logs.

Returns true when the ban existed

exports.APIAC:unbanAllPlayers(unbannedBy)
Lifts every ban. A backup of the old list is saved next to bans.json.

Returns how many bans were lifted

exports.APIAC:getBanInfo(banId)
Looks up a ban: id, name, reason, bannedBy, expiresAt (-1 means never) and more.

Returns a ban table or nil

exports.APIAC:banIdentifiers({ license, identifiers, tokens, name }, reason, details, durationDays, bannedBy)
Bans a player who is offline, by the identifiers and tokens your server saved. When one of them is already banned you get that ban back and nothing is added. 0 days means permanent.

Returns the ban ID and whether it already existed, or false

exports.APIAC:unbanIdentifiers(identifiers, tokens, unbannedBy)
Lifts every ban that matches any of the identifiers or tokens.

Returns a list of lifted ban IDs

findBanServer
exports.APIAC:findBan(identifiers, tokens)
The active ban that matches the identifiers or tokens, if there is one.

Returns id, name, reason, bannedBy, date, expiresAt or nil

exports.APIAC:toggleBypass(source, toggle)
Turns bypass on or off until the player leaves. Handy for staff duty scripts.

Returns true when it worked

exports.APIAC:tempBypass(source, seconds)
Bypass that runs out by itself after the given number of seconds.

Returns true when it worked

hasBypassServer
exports.APIAC:hasBypass(source)
Whether APIAC will skip this player. Admins always have bypass.

Returns true or false

isAdminServer
exports.APIAC:isAdmin(source)
Whether APIAC treats the player as an admin.

Returns true or false

exports.APIAC:screenshot(source)
Takes a screenshot and uploads it to the panel. Waits for the upload, up to about 8 seconds.

Returns an image URL or nil

exports.APIAC:recordClip(source)
Same as screenshot, but saves the last few seconds of gameplay. Needs Gameplay recording on.

Returns a clip URL or nil

exports.APIAC:getPlayerIdentifiers(source)
The identifiers APIAC bans by. IPs are included only with Ban IP addresses on.

Returns a list of strings

exports.APIAC:getPlayTime(source)
How long the player has played on your server, this session included. Returns nil for a moment after they join, while the profile loads.

Returns seconds or nil

exports.APIAC:getThreatScore(source)
The same threat score your rules use. It goes up for a VPN, bans on other servers, a fresh Discord account and a brand new player. Returns nil while the profile loads.

Returns 0 to 100 or nil

exports.APIAC:getPlayerTokens(source)
The player's hardware tokens.

Returns a list of strings

server.lua
RegisterCommand("acban", function(source, args)    if source ~= 0 and not exports.APIAC:isAdmin(source) then return end    local target, days = tonumber(args[1]), tonumber(args[2])    local reason = table.concat(args, " ", 3)    exports.APIAC:banPlayer(target, reason, { by = GetPlayerName(source) or "Console" }, days)end, false)
server.lua
RegisterCommand("duty", function(source)    if not IsPlayerAceAllowed(source, "group.staff") then return end    exports.APIAC:toggleBypass(source, true)end, false)

Server events

EventArguments
APIAC/internal/playerBannedsource, ban: the same table getBanInfo returns. source is nil for an offline ban.
APIAC/internal/playerKickedsource, reason
APIAC/internal/playerUnbannedban, unbannedBy
server.lua
AddEventHandler("APIAC/internal/playerBanned", function(source, ban)    if not ban?.id then return end    print(ban.name .. " was banned for " .. ban.reason .. ", ban ID " .. ban.id)end)

Hooks

Most scripts never need these. Every Lua resource with APIAC installed calls them for you. Call a hook yourself when your code runs where APIAC can't follow it: C# and JavaScript resources, natives called by hash, or resources on the ignored list.

Call the hook right before the action, unless the description says otherwise.

client.lua
exports.APIAC:hasTeleported()Citizen.InvokeNative(0x06843DA7060A026B, PlayerPedId(), x, y, z, false, false, false, false)

Position and camera

exports.APIAC:hasTeleported()
Before you move the player, put them into a vehicle or use StartPlayerTeleport.
exports.APIAC:hasChangedPedModel(model)
Before SetPlayerModel, with the new model.
exports.APIAC:setSpectatorMode(toggle)
When you turn spectator mode on or off.
createCamClient
exports.APIAC:createCam(cam)
Right after you create a scripted camera, with its handle.
exports.APIAC:destroyCam(cam)
Before you destroy that camera.
exports.APIAC:destroyCams()
Before DestroyAllCams.

Health and damage

exports.APIAC:healthRefilled()
Before you set the player's health.
exports.APIAC:playerRevived()
Before you revive or resurrect the player.
exports.APIAC:armourChanged()
Before you give or set armour.
exports.APIAC:resettedStamina()
Before you restore stamina.
exports.APIAC:isInvincible(toggle)
When you make the player invincible or take it back.
exports.APIAC:proofsEnabled(toggle)
When you change the player's damage proofs.
exports.APIAC:canBeDamaged(toggle)
When you change whether the player can be damaged.
isVisibleClient
exports.APIAC:isVisible(toggle)
When you hide or show the player.
exports.APIAC:setCriticalHits(toggle)
When you change critical hits for the player.

Weapons

exports.APIAC:giveWeapon(weaponHash)
Before you give the player a weapon.
exports.APIAC:removeWeapon(weaponHash)
Before you take a weapon away.
exports.APIAC:removeAllWeapons()
Before you take all weapons away.
exports.APIAC:hasAddedAmmo()
Before you add, set or refill ammo.
exports.APIAC:setNewDamage(weaponHash, modifier)
Before you change a weapon's damage modifier.
exports.APIAC:allowShootTask()
Before you give the player's ped a shooting task.

Vehicles and movement

exports.APIAC:sprintMultiplier(multiplier)
Before you change the player's sprint speed.
exports.APIAC:newTopSpeedModifier(value)
Before you change a vehicle's top speed.
exports.APIAC:newCheatPowerIncrease(value)
Before you boost a vehicle's engine power.
exports.APIAC:newGravity(value)
Before you change a vehicle's gravity.

Screen and input

exports.APIAC:allowTexture(textureDict)
Before you load or draw a texture dictionary or a scaleform.
exports.APIAC:allowPlayerBlip(entity)
Before you add a blip to another player.
exports.APIAC:displayInputBox()
Before you open the on-screen keyboard.
disableE2Client
exports.APIAC:disableE2()
While your script shows the mouse cursor in game. Call it again every few seconds.
exports.APIAC:disableCamControls()
While you disable single controls. Call it again every few seconds.
exports.APIAC:disableAllControls()
While you disable all controls. Call it again every few seconds.

On the server

exports.APIAC:CreateEntity(model)
Before your server code spawns a vehicle, ped or object outside Lua.

More from us