Skip to content

Exports

Use these from other resources to interact with the zombie system.

Server

ExportParametersReturnsDescription
CreateZombie(data: table)table | nilSpawn a single zombie. Returns the zombie object or nil if spawning is disabled.
GetZombie(entity: number)table | nilGet 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)tableCreate 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()tableReturns Config.SafeZones.
GetZombieModels()tableReturns a hash table of all registered zombie ped model hashes.
GetZombieTypes()tableReturns Config.ZombieTypes.

CreateZombie data

FieldTypeRequiredDescription
coordsvector4YesSpawn position and heading
zonestringYesGTA zone name (e.g. "CHU") or "CUSTOM_SPAWN"
zombieTypestringNoKey from Config.ZombieTypes (default: "default")
modelhashNoPed model override
baseHealthnumberNoOverride base health
redZonestringNoRed zone key for difficulty multipliers
nestnumberNoNest ID for nest difficulty multipliers

SpawnZombies data (optional 4th argument)

FieldTypeDefaultDescription
xOffsetMinnumber-10Minimum X offset from startCoords
xOffsetMaxnumber10Maximum X offset
yOffsetMinnumber-10Minimum Y offset
yOffsetMaxnumber10Maximum Y offset

CreateNest data

FieldTypeRequiredDescription
coordsvector3YesNest centre position
radiusnumberYesNest influence radius
barrelCountnumberYesNumber of barrels to spawn
zonenumberYesNest zone index
zombieLimitnumberNoMax zombies tied to this nest
healthnumberNoNest object health
barrelRadiusnumberNoSpread radius for barrels
multipliernumberNoDamage multiplier for nest zombies
healthMultipliernumberNoHealth 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

ExportParametersReturnsDescription
IsInSafeZone(coords: vector3)booleanWhether the given coordinates are inside a safe zone.
IsInNoSpawnZone(coords: vector3)booleanWhether 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 | booleanReturns 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.