Commands/Lua
Reference for console commands, Lua hooks and Lua commands in CS2D.
- Console Commands are entered in console, executed with key-binds, cfg-files or with Lua parse
- Lua Hooks execute Lua when events occur - some have a return value which can change the game behavior
- Lua Commands are used to retrieve game data or to perform actions in Lua scripts
CS2D Console Commands
Lua Hooks
die
Categories
Parameters
- victim: player id
- killer: player id
- weapon: weapon type ID / special source ID
- x: death x (pixels)
- y: death y (pixels)
- killerobject: id of dynamic object that killed (or 0 if not killed by object)
Info
When a player (victim) dies.
killer is the player ID of the player who performed the kill (can also be 0 if the death was not caused by another player). victim is the ID of the player who died.
weapon can be a weapon type ID or a special source ID. x and y define the position of this death on the map in pixels.
If the player was killed by an object like a turret, gate field or barbed wire etc. then killerobject will contain the ID of that object. Otherwise (if the player was killed by another player or the environment) it will be 0.
You can return 1 in this hook to prevent dropping items (except for map goal items like bomb and flag).
Weapon and item type IDs:
Special source IDs:
killer is the player ID of the player who performed the kill (can also be 0 if the death was not caused by another player). victim is the ID of the player who died.
weapon can be a weapon type ID or a special source ID. x and y define the position of this death on the map in pixels.
If the player was killed by an object like a turret, gate field or barbed wire etc. then killerobject will contain the ID of that object. Otherwise (if the player was killed by another player or the environment) it will be 0.
You can return 1 in this hook to prevent dropping items (except for map goal items like bomb and flag).
Weapon and item type IDs:
Special source IDs:
Note: The kill hook works nearly the same but is only called when a death is caused by another player.
Note: This hook allows you to avoid that the killed player drops weapons/items by returning 1 (not possible with the kill hook)!
Return Values
- 0: proceed normally (and drop stuff depending on settings)
- 1: drop bomb/flag only (all other carried items will get lost)