SAFScriptsDocs

Exports & events

SAF Anticheat is coming soon. These docs describe the build that will ship.

On this page

Server exports

Lua
exports['saf-anticheat']:AllowTeleport(src, seconds)      -- grace window for a legit teleport
exports['saf-anticheat']:AllowHeal(src)                   -- the next health jump is legit
exports['saf-anticheat']:AllowEntities(src, n, seconds)   -- extra spawn allowance
exports['saf-anticheat']:Flag(src, code, severity, data)  -- raise a flag (your own codes work too)
exports['saf-anticheat']:GetScore(src)
exports['saf-anticheat']:Ban(src, reason, duration)       -- duration in seconds, 0 = permanent; returns the ban id
exports['saf-anticheat']:Unban(banId)
exports['saf-anticheat']:IsExempt(src)                    -- true only when everything is ignored for them

Client exports

Lua
exports['saf-anticheat']:AllowTeleport(seconds)           -- asks the server for a (limited) grace window

A client request opens the client grace window: flags inside it count half, and a player can ask at most 6 times per 5 minutes. Prefer the server export when the teleport starts on the server.

Grace event

If you'd rather not depend on the resource being started, fire the event instead of the export:

Lua
-- server
TriggerEvent('saf-anticheat:grace', src, 'teleport', 10)

-- carry and escort scripts: covers PLY_ATTACH for 30 s
TriggerEvent('saf-anticheat:grace', src, 'attach')

Examples

A housing script that teleports players into a shell:

Lua
-- server
RegisterNetEvent('my-housing:server:enter', function(houseId)
    local src = source
    exports['saf-anticheat']:AllowTeleport(src, 10)
    TriggerClientEvent('my-housing:client:teleportInside', src, houseId)
end)

A medic script that revives and heals:

Lua
exports['saf-anticheat']:AllowHeal(target)
TriggerClientEvent('my-ems:client:revive', target)

A check of your own that goes through the same score, alerts and cases:

Lua
exports['saf-anticheat']:Flag(src, 'SHOP_PRICE', 40, { item = item, paid = paid, price = price })
SAF Scripts by San Andreas' Finest StoreDiscordsupprot@safrp.org

Not affiliated with or endorsed by Rockstar Games, Take-Two Interactive or Cfx.re.