Exports
Use these from other resources to interact with the zombie system.
Server
| Export | Parameters | Returns | Description |
|---|---|---|---|
CreateZombie | (data: table) | table | nil | Spawn a single zombie. Returns the zombie object or nil if spawning is disabled. |
GetZombie | (entity: number) | table | nil | Get the server-side zombie object for an entity handle. |
SpawnZombies | (startCoords: vector3, zombieTypeKey: string, count: number, data?: table) | — | Spawn multiple zombies in a radius around startCoords. |
AddNoiseEvent | (name: string, coords: vector3, radius: number, time: number) | — | Create a noise event that attracts nearby zombies. time is duration in milliseconds. |
RemoveNoiseEvent | (name: string) | — | Remove a noise event by name. |
CreateNest | (data: table) | table | Create a zombie nest at runtime. |
DeleteNest | (nestId: number) | — | Remove a nest by ID. |
AddAreaMultiplier | (areaId: string, coords: vector3, radius: number, limitMultiplier: number, spawnMultiplier: number) | — | Add a circular area that modifies zombie density limits and spawn rate. |
RemoveAreaMultiplier | (areaId: string) | — | Remove an area multiplier by ID. |
GetSafeZoneConfig | () | table | Returns Config.SafeZones. |
GetZombieModels | () | table | Returns a hash table of all registered zombie ped model hashes. |
GetZombieTypes | () | table | Returns Config.ZombieTypes. |
CreateZombie data
| Field | Type | Required | Description |
|---|---|---|---|
coords | vector4 | Yes | Spawn position and heading |
zone | string | Yes | GTA zone name (e.g. "CHU") or "CUSTOM_SPAWN" |
zombieType | string | No | Key from Config.ZombieTypes (default: "default") |
model | hash | No | Ped model override |
baseHealth | number | No | Override base health |
redZone | string | No | Red zone key for difficulty multipliers |
nest | number | No | Nest ID for nest difficulty multipliers |
SpawnZombies data (optional 4th argument)
| Field | Type | Default | Description |
|---|---|---|---|
xOffsetMin | number | -10 | Minimum X offset from startCoords |
xOffsetMax | number | 10 | Maximum X offset |
yOffsetMin | number | -10 | Minimum Y offset |
yOffsetMax | number | 10 | Maximum Y offset |
CreateNest data
| Field | Type | Required | Description |
|---|---|---|---|
coords | vector3 | Yes | Nest centre position |
radius | number | Yes | Nest influence radius |
barrelCount | number | Yes | Number of barrels to spawn |
zone | number | Yes | Nest zone index |
zombieLimit | number | No | Max zombies tied to this nest |
health | number | No | Nest object health |
barrelRadius | number | No | Spread radius for barrels |
multiplier | number | No | Damage multiplier for nest zombies |
healthMultiplier | number | No | Health multiplier for nest zombies |
Examples
lua
exports["prp-zombies"]:CreateZombie({
coords = vec4(100.0, -200.0, 30.0, 90.0),
zone = "CHU",
zombieType = "runner",
})lua
exports["prp-zombies"]:SpawnZombies(
vector3(100.0, -200.0, 30.0),
"screamer",
5,
{ xOffsetMin = -15, xOffsetMax = 15, yOffsetMin = -15, yOffsetMax = 15 }
)lua
exports["prp-zombies"]:AddNoiseEvent("alarm_1", vector3(200.0, -300.0, 40.0), 100.0, 15000)lua
exports["prp-zombies"]:AddAreaMultiplier("event_zone", vector3(0.0, 0.0, 70.0), 200.0, 2.0, 1.5)Client
| Export | Parameters | Returns | Description |
|---|---|---|---|
IsInSafeZone | (coords: vector3) | boolean | Whether the given coordinates are inside a safe zone. |
IsInNoSpawnZone | (coords: vector3) | boolean | Whether the given coordinates are inside a no-spawn zone. |
SetProtected | (protected: boolean) | — | When true, zombies ignore the local player. |
SetZombieNoiseOverride | (noise: number | false) | — | Override the player's footstep noise value. Pass false to reset. |
SetOnFootNoiseModifier | (modifier: number) | — | Multiplier applied to on-foot noise values. |
getLastHitByZombie | (checkTime?: number) | number | boolean | Returns last hit timestamp, or true/false if hit within checkTime ms. |
AddAreaMultiplier | (areaId: string, coords: vector3, radius: number, multiplier: number, spawnMultiplier?: number) | — | Client-side area multiplier for spawn density near the player. |
RemoveAreaMultiplier | (areaId: string) | — | Remove a client area multiplier. |
GetZombieTypes | () | table[] | List of { value, label } entries for UI dropdowns. |
Examples
lua
local inSafe = exports["prp-zombies"]:IsInSafeZone(GetEntityCoords(PlayerPedId()))lua
exports["prp-zombies"]:SetProtected(true)lua
local wasHit = exports["prp-zombies"]:getLastHitByZombie(5000)Noise events from other resources
Use the server export AddNoiseEvent to make zombies investigate custom events — alarms, generators, breaking glass, etc. Events are batched and synced to clients automatically.