Exports
Client Side Exports
1. spawnZombies
spawnZombiesspawnZombies(zombieType, coords, count)
Spawns zombies at the given location.
Arguments:
zombieType(string): Zombie type name fromConfig.types(e.g.,"default","screamer","exploder").coords(vector3): Where to spawn the zombies.count(number, optional): How many zombies to spawn. Default is1.
Returns: Nothing.
Usage: Use this from other scripts to spawn zombies for events, missions, etc.
Example:
-- Spawn one default zombie exports['5s_zombies']:spawnZombies('default', vector3(100.0, 200.0, 30.0)) -- Spawn 5 exploders exports['5s_zombies']:spawnZombies('exploder', vector3(150.0, 250.0, 35.0), 5) -- Spawn a screamer near the player exports['5s_zombies']:spawnZombies('screamer', GetEntityCoords(PlayerPedId()) + vector3(10.0, 0.0, 0.0), 1)Notes:
zombieTypemust exist inConfig.typesor you will see a warning.coordsmust be a validvector3.Zombies spawn with a small offset between them so they don't overlap.
Spawn animations play automatically (except for animal types).
2. getZombieCount
getZombieCountgetZombieCount()
Returns the number of zombies near the player (in render/tracking distance).
Arguments: None.
Returns:
number- count of nearby zombies.Usage: Use this to display zombie count on a HUD, scale difficulty, or trigger events based on nearby threat level.
Example:
3. isInGreenZone
isInGreenZoneisInGreenZone()
Checks if the player is inside a safe zone.
Arguments: None.
Returns:
boolean-trueif in a safe zone,falseif not.Usage: Use this to enable or disable features depending on whether the player is safe.
Example:
Notes:
Safe zones are set in
Config.zones.safeZones.Checks the player's current position.
4. isInDangerZone
isInDangerZoneisInDangerZone()
Checks if the player is inside a danger zone.
Arguments: None.
Returns:
boolean-trueif in a danger zone,falseif not.Usage: Use this to trigger special effects or UI when the player enters a danger zone.
Example:
Notes:
Danger zones are set in
Config.zones.dangerZones.These zones have more zombies and special enemy types.
5. isIgnoredByZombies
isIgnoredByZombiesisIgnoredByZombies()
Checks if the local player is currently ignored by all zombies.
Arguments: None.
Returns:
boolean-trueif ignored,falseif not.Usage: Use this to check if the player is in a "safe" state set by the server (e.g., during a cutscene, in admin mode, etc.).
Example:
Notes:
This state is set server-side via
setIgnoredByZombies. See server exports.
6. addNoSpawnZone
addNoSpawnZoneaddNoSpawnZone(id, coords, radius)
Registers a no-spawn zone. Zombies will not spawn at coordinates inside this zone.
Arguments:
id(string): Unique identifier for this zone (e.g.,"myresource:zone_1").coords(vector3): Center of the no-spawn zone.radius(number): Radius in meters.
Returns: Nothing.
Usage: Use this to prevent zombie spawns around player bases, event areas, or other protected locations. Unlike safe zones (which affect player state), no-spawn zones only prevent zombies from spawning at those coordinates.
Example:
Notes:
The
idmust be unique. If you call this again with the sameid, it overwrites the previous zone.This is used internally by
5s_buildingto protect Tool Cupboard areas.
7. removeNoSpawnZone
removeNoSpawnZoneremoveNoSpawnZone(id)
Removes a previously registered no-spawn zone.
Arguments:
id(string): The same identifier used when adding the zone.
Returns: Nothing.
Example:
Server Side Exports
1. setIgnoredByZombies
setIgnoredByZombiessetIgnoredByZombies(source, ignored)
Makes a player invisible to all zombies, or restores normal detection.
Arguments:
source(number): Player server ID.ignored(boolean):trueto ignore,falseto restore.
Returns: Nothing.
Usage: Use this for admin godmode, cutscenes, safe trader NPCs, spawn protection, or any scenario where a player should not be targeted.
Example:
2. isIgnoredByZombies
isIgnoredByZombiesisIgnoredByZombies(source)
Checks if a player is currently ignored by zombies.
Arguments:
source(number): Player server ID.
Returns:
boolean-trueif ignored,falseif not.Example:
3. setSpawnsPaused
setSpawnsPausedsetSpawnsPaused(source, paused)
Pauses or resumes zombie spawning around a specific player. When paused, no new zombies will be spawned for this player's sector.
Arguments:
source(number): Player server ID.paused(boolean):trueto pause,falseto resume.
Returns: Nothing.
Usage: Use this during loading screens, character selection, instanced interiors, or any time you want to temporarily stop zombie spawns for a player.
Example:
4. getPlayersInDangerZone
getPlayersInDangerZonegetPlayersInDangerZone(zoneId)
Returns a list of players currently inside a danger zone.
Arguments:
zoneId(number): The index of the danger zone inConfig.zones.dangerZones(1-based).
Returns:
table- array of player server IDs, or empty table if none.Usage: Use this for zone-based events, leaderboards, or scaling difficulty based on player count.
Example:
5. overrideSquareMultiplier
overrideSquareMultiplieroverrideSquareMultiplier(squareId, multiplier)
Overrides the spawn multiplier for a specific map sector. This stacks with zone archetype and night multipliers.
Arguments:
squareId(number): The sector ID (from the grid system).multiplier(number): Spawn count multiplier (e.g.,2.0for double spawns,0.0to disable spawns).
Returns: Nothing.
Usage: Use this for dynamic events - increase spawns during a horde event, or reduce spawns in a cleared area.
Example:
6. getSquareMultiplier
getSquareMultipliergetSquareMultiplier(squareId)
Gets the current spawn multiplier override for a map sector.
Arguments:
squareId(number): The sector ID.
Returns:
number- current multiplier (default1.0if not overridden).Example:
7. getZombieCountInSquare
getZombieCountInSquaregetZombieCountInSquare(squareId)
Returns the number of zombies currently alive in a map sector.
Arguments:
squareId(number): The sector ID.
Returns:
number- zombie count in that sector.Usage: Use this for monitoring server load, balancing events, or displaying zone population.
Example:
8. getPlayerSquare
getPlayerSquaregetPlayerSquare(source)
Returns the map sector ID a player is currently in.
Arguments:
source(number): Player server ID.
Returns:
number | nil- sector ID, ornilif the player hasn't entered a sector yet.Usage: Use this with other sector-based exports like
getZombieCountInSquareoroverrideSquareMultiplier.Example:
Last updated