WhitelistExports
The whitelist temporarily turns off all detections for one player. Use it when a script performs a legitimate action that would otherwise be flagged, such as a medical system or a custom ability.
If only one detection needs to be quiet for a few seconds, use AllowDetection instead. See Trusted Resources.
⚠️ While a whitelist is active, nothing is detected for that player. Use the shortest duration you can, and remove it as soon as the activity finishes.
Server-side whitelisting
exports["sbanticheat"]:AddWhitelist(serverId, duration)| Parameter | Type | Description |
|---|---|---|
serverId |
number |
The player's server ID |
duration |
number |
Seconds. -1 or nil means until RemoveWhitelist is called |
exports["sbanticheat"]:AddWhitelist(source, 300) -- 5 minutes
exports["sbanticheat"]:AddWhitelist(source, -1) -- until removedEvery add, change, removal and expiry is posted to the whitelist webhook (SB.webhooks.whitelist). Turn this off with SB.logging.logWhitelist. The embed shows which script asked, such as qb-policejob (server). A client request with no script name is marked with a warning, because it usually means someone fired the event by hand.
Removing a whitelist
exports["sbanticheat"]:RemoveWhitelist(source)Detections come back on the next check. Remove the whitelist when the activity ends rather than waiting for the timer.
Checking a whitelist
if exports["sbanticheat"]:IsWhitelisted(source) then
print("Player is currently whitelisted")
endExample
RegisterNetEvent("myjob:server:startAbility", function()
local src = source
exports["sbanticheat"]:AddWhitelist(src, 300)
-- Start your special ability here
end)
RegisterNetEvent("myjob:server:stopAbility", function()
local src = source
exports["sbanticheat"]:RemoveWhitelist(src)
-- Stop your special ability here
end)Best practice
Do not turn a detection off globally for one script. Whitelist the player doing the legitimate action so everyone else stays protected.
-- Don't do this:
SB.clientChecks.superSpeed = falseClient-side whitelist exports
Client scripts can request a whitelist for the local player. The client only sends a request. The server validates it and decides whether to apply it, so a client cannot switch the AntiCheat off on its own.
exports["sbanticheat"]:AddWhitelist(300)
...
exports["sbanticheat"]:RemoveWhitelist()CreateThread(function()
exports["sbanticheat"]:AddWhitelist(300)
TaskPlayAnim(PlayerPedId(), "dead", "dead_a", 8.0, -8.0, -1, 1, 0, false, false, false)
end)💡 For important gameplay systems, server-side control is recommended whenever possible.
