About This File
Disables all NPCs on the RedM server — pedestrians, coaches (wagons), and horse riders.
Compatible with scripts that intentionally spawn NPCs via a whitelist system.
Installation
1. Drop the `no_npcs` folder into your server's `resources` directory.
2. Add `ensure no_npcs` to your `server.cfg`.
Compatibility - Whitelisting Spawned NPCs
If another resource spawns NPCs/vehicles that should NOT be deleted, whitelist them.
From a client-side script
```lua
local ped = CreatePed(...)
exports['no_npcs']:whitelistAdd(ped)
-- When done:
exports['no_npcs']:whitelistRemove(ped)
```
### From a server-side script
```lua
-- entityNetId = NetworkGetNetworkIdFromEntity(entity) on the client, sent to server
exports['no_npcs']:whitelistAdd(entityNetId)
exports['no_npcs']:whitelistRemove(entityNetId)
```
Trigger from client to server (network event)
```lua
TriggerServerEvent('no_npcs:requestWhitelistAdd', NetworkGetNetworkIdFromEntity(myPed))
TriggerServerEvent('no_npcs:requestWhitelistRemove', NetworkGetNetworkIdFromEntity(myPed))
```
Toggle Suppression at Runtime (client export)
```lua
exports['no_npcs']:setSuppression(false) -- turn off
exports['no_npcs']:setSuppression(true) -- turn back on
```
Recommended Comments
There are no comments to display.
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.