Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Category: player (56)

Lua Hook 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:
items

Special source IDs:
killids

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)

Lua Command Lua Commands