Client

This page documents all available client-side exports for SD-Horde. These exports allow you to interact with the horde system from other client-side scripts.


Game State

IsPlayerInHorde

Check if the local player is currently in a horde game.

local inGame, gameState = exports['sd-horde']:IsPlayerInHorde()

Returns

Name
Type
Description

inGame

boolean

Whether the player is in a horde game

gameState

string

Current game state

Game States

State
Description

none

Not in a game

starting

Game is initializing

active

Combat phase - fighting enemies

looting

Looting phase between rounds

perk_voting

Players are voting on perks

ending

Game is ending

completed

Game has been completed

Example


GetCurrentRound

Get the current round number in the active horde game.

Returns

Name
Type
Description

round

number|nil

Current round number, or nil if not in game

Example


GetCurrentMap

Get the current map name being played.

Returns

Name
Type
Description

mapName

string|nil

Map identifier, or nil if not in game

Example


HasPendingGame

Check if the local player has a pending game (heading to entry location).

Returns

Name
Type
Description

hasPending

boolean

Whether the player has a pending game

isHost

boolean

Whether the player is the host of the pending game

Example


Player State

IsPlayerDead

Check if the local player is dead/downed in the current horde game. Uses comprehensive detection including medical system state bags.

Returns

Name
Type
Description

isDead

boolean

Whether the player is dead or downed

reason

string|nil

Detection source (for debugging)

Detection Reasons

Reason
Description

native_dead

GTA native IsEntityDead check

native_dying

GTA native IsPedDeadOrDying check

state_dead

Player state bag indicates dead

already_notified

Death already processed by horde system

revive_grace_period

Player was recently revived

Example


IsCarryingLoot

Check if the local player is currently carrying loot.

Returns

Name
Type
Description

isCarrying

boolean

Whether the player is carrying loot

lootValue

number

Value of carried loot (0 if not carrying)

Example


GetPlayerLevel

Get the local player's horde level, XP, and statistics.

Returns

Name
Type
Description

levelInfo

table|nil

Level information, or nil if unavailable

Level Info Object

Field
Type
Description

level

number

Current horde level

xp

number

Current XP amount

stats

table

Player statistics (kills, deaths, rounds, etc.)

Example


UI Controls

OpenHordeMenu

Open the horde menu programmatically. Useful for custom NPCs or interaction systems.

Returns

Name
Type
Description

success

boolean

Whether the menu was opened (false if already in game)

Example


CloseAllUI

Close all open horde UI elements (shop, perk selection, end game loot, HUD).

Returns

Name
Type
Description

success

boolean

Always returns true

Example


Perks System

These exports allow you to interact with the perk system during horde games.

ApplyPerk

Apply a perk to the local player.

Parameters

Name
Type
Description

perkId

string

The perk identifier to apply


RemovePerk

Remove a specific perk from the local player.

Parameters

Name
Type
Description

perkId

string

The perk identifier to remove


ClearAllPerks

Remove all active perks from the local player.


IsPerkActive

Check if a specific perk is currently active.

Parameters

Name
Type
Description

perkId

string

The perk identifier to check

Returns

Name
Type
Description

isActive

boolean

Whether the perk is active


GetActivePerks

Get a table of all currently active perks.

Returns

Name
Type
Description

activePerks

table

Table of active perk IDs (key = perkId, value = true)

Example


GetActivePerksForHUD

Get active perks formatted for HUD display.

Returns

Name
Type
Description

perksForHUD

table

Array of perk data formatted for UI display


GetPerkModifiers

Get all current perk modifiers affecting the player.

Returns

Name
Type
Description

modifiers

table

Table of all active modifiers


Perk Modifier Exports

These exports return specific modifier values based on active perks.

Damage Modifiers


Weapon Modifiers


Economy Modifiers


Enemy Modifiers

These affect how enemies behave (typically from debuff perks):


Perk Event Hooks

OnEnemyKilled

Trigger perk effects when an enemy is killed.

Parameters

Name
Type
Description

enemyPed

number

The enemy ped entity

wasHeadshot

boolean

Whether the kill was a headshot


OnPlayerDamaged

Trigger perk effects when the player takes damage.

Parameters

Name
Type
Description

damageAmount

number

Amount of damage taken


Mystery Box

SpawnMysteryBox

Spawn the mystery box for a specific map.

Parameters

Name
Type
Description

mapName

string

The map identifier


RemoveMysteryBox

Remove the currently spawned mystery box.


UseMysteryBox

Use the mystery box (initiate the spin animation and reward).

Last updated