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.
sourceis always the server ID of an online player.
Server exports
exports.APIAC:banPlayer(source, reason, details, days)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)Returns true when the player was kicked
exports.APIAC:unbanPlayer(banId, unbannedBy)unbannedBy is a name for the logs.Returns true when the ban existed
exports.APIAC:unbanAllPlayers(unbannedBy)bans.json.Returns how many bans were lifted
exports.APIAC:getBanInfo(banId)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)0 days means permanent.Returns the ban ID and whether it already existed, or false
exports.APIAC:unbanIdentifiers(identifiers, tokens, unbannedBy)Returns a list of lifted ban IDs
exports.APIAC:findBan(identifiers, tokens)Returns id, name, reason, bannedBy, date, expiresAt or nil
exports.APIAC:toggleBypass(source, toggle)Returns true when it worked
exports.APIAC:tempBypass(source, seconds)Returns true when it worked
exports.APIAC:hasBypass(source)Returns true or false
exports.APIAC:isAdmin(source)Returns true or false
exports.APIAC:screenshot(source)Returns an image URL or nil
exports.APIAC:recordClip(source)screenshot, but saves the last few seconds of gameplay. Needs Gameplay recording on.Returns a clip URL or nil
exports.APIAC:getPlayerIdentifiers(source)Returns a list of strings
exports.APIAC:getPlayTime(source)nil for a moment after they join, while the profile loads.Returns seconds or nil
exports.APIAC:getThreatScore(source)nil while the profile loads.Returns 0 to 100 or nil
exports.APIAC:getPlayerTokens(source)Returns a list of strings
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)RegisterCommand("duty", function(source) if not IsPlayerAceAllowed(source, "group.staff") then return end exports.APIAC:toggleBypass(source, true)end, false)Server events
| Event | Arguments |
|---|---|
APIAC/internal/playerBanned | source, ban: the same table getBanInfo returns. source is nil for an offline ban. |
APIAC/internal/playerKicked | source, reason |
APIAC/internal/playerUnbanned | ban, unbannedBy |
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.
exports.APIAC:hasTeleported()Citizen.InvokeNative(0x06843DA7060A026B, PlayerPedId(), x, y, z, false, false, false, false)Position and camera
exports.APIAC:hasTeleported()StartPlayerTeleport.exports.APIAC:hasChangedPedModel(model)SetPlayerModel, with the new model.exports.APIAC:setSpectatorMode(toggle)exports.APIAC:createCam(cam)exports.APIAC:destroyCam(cam)exports.APIAC:destroyCams()DestroyAllCams.Health and damage
exports.APIAC:healthRefilled()exports.APIAC:playerRevived()exports.APIAC:armourChanged()exports.APIAC:resettedStamina()exports.APIAC:isInvincible(toggle)exports.APIAC:proofsEnabled(toggle)exports.APIAC:canBeDamaged(toggle)exports.APIAC:isVisible(toggle)exports.APIAC:setCriticalHits(toggle)Weapons
exports.APIAC:giveWeapon(weaponHash)exports.APIAC:removeWeapon(weaponHash)exports.APIAC:removeAllWeapons()exports.APIAC:hasAddedAmmo()exports.APIAC:setNewDamage(weaponHash, modifier)exports.APIAC:allowShootTask()Vehicles and movement
exports.APIAC:sprintMultiplier(multiplier)exports.APIAC:newTopSpeedModifier(value)exports.APIAC:newCheatPowerIncrease(value)exports.APIAC:newGravity(value)Screen and input
exports.APIAC:allowTexture(textureDict)exports.APIAC:allowPlayerBlip(entity)exports.APIAC:displayInputBox()exports.APIAC:disableE2()exports.APIAC:disableCamControls()exports.APIAC:disableAllControls()On the server
exports.APIAC:CreateEntity(model)