> For the complete documentation index, see [llms.txt](https://sbscripts.gitbook.io/sb-scripts/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sbscripts.gitbook.io/sb-scripts/sb-anticheat/object-whitelist.md).

# Object Whitelist

SB AntiCheat can control which props players are allowed to spawn. Lists live in `shared/models.lua`.

### Whitelist mode

```lua
SB.serverChecks.useObjectWhitelist = true
```

When enabled, only objects in `SB.lists.shared.whitelistedObjects` may spawn. Anything else is handled by `nonWhitelistedObject`, which is usually `"log"` so unknown props don't get anyone banned.

```lua
SB.lists.shared.whitelistedObjects = {
    [GetHashKey("prop_cs_burger_01")]   = true,
    [GetHashKey("prop_tool_spanner01")] = true,
    [GetHashKey("prop_cs_coffeecup")]   = true,
}
```

Add a new prop with `GetHashKey("model_name")`. Compare hashes with `GetHashKey`, not backtick literals.

### Blacklist mode

```lua
SB.serverChecks.useObjectWhitelist = false
```

Everything is allowed except objects in `blacklistedObjects`.

### The blacklist always applies

The blacklist is enforced in both modes. A model in `blacklistedObjects` is deleted and punished by `SB.serverChecks.blacklistedObjects`, even if it is also on the whitelist.

```lua
SB.serverChecks.useObjectWhitelist = true            -- only whitelisted props allowed
SB.serverChecks.nonWhitelistedObject = "log"         -- what to do with props not on the whitelist
SB.serverChecks.blacklistedObjects = "ban"           -- what to do with blacklisted props
SB.serverChecks.blacklistedObjectsDeleteAndPunish = true   -- false = delete silently, no punishment
```

### Registering props from code

If your scripts spawn props, register them from code instead of editing `models.lua`:

```lua
exports["sbanticheat"]:AllowObjectModel("prop_money_bag_01")
exports["sbanticheat"]:RemoveObjectModel("prop_money_bag_01")
```

Allowed models override both the whitelist and the blacklist for every player until removed or the resource restarts. See [Exports](/sb-scripts/sb-anticheat/exports.md).

### Recommended setup

For servers where spawning must be tightly controlled:

```lua
SB.serverChecks.useObjectWhitelist = true
SB.serverChecks.blacklistedObjects = "ban"
```

Make sure every legitimate prop used by jobs, emotes, missions and other resources is on the whitelist.
