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
equipCategories
Parameters
- player (1-32): id of a player
- weapon (1-255): type id (int) or name (string) of a weapon
Info
Give a weapon to a player (as server only). The weapon can be specified using its ID or its name.
The name can be the displayed name or a simplified version (lowercase without whitespaces/special characters, just letters and numbers)
Weapon and item IDs:
Usage examples (equipping to player 1 here, which is always you when using "New Game"):
equip 1 51 // ID
equip 1 "Molotov Cocktail" // full name
equip 1 ak47 // simplified name
equip 1 fiveseven // simplified name
Note: When using equip, a player can carry multiple different primary and secondary weapons. This is not possible when simply collecting weapons in-game.
Note: A player can hold each weapon only one time. Equip the same weapon again to re-fill the ammunition of this weapon.
Attention: NEVER use the equip command in Lua spawn hooks! Spawn performs its own equips which can lead to problems. Use the return value of your hooked spawn function instead! Put the following at the end of the function:
return "weaponid,weaponid,weaponid,..."
with weaponid = type id of weapons you want to equip
Lua Hooks
Lua Commands
Categories
Parameters
- player (1-32): id of a player
- weapon (1-255): type id (int) or name (string) of a weapon
Info
Give a weapon to a player (as server only). The weapon can be specified using its ID or its name.
The name can be the displayed name or a simplified version (lowercase without whitespaces/special characters, just letters and numbers)
Weapon and item IDs:
Usage examples (equipping to player 1 here, which is always you when using "New Game"):
The name can be the displayed name or a simplified version (lowercase without whitespaces/special characters, just letters and numbers)
Weapon and item IDs:
Usage examples (equipping to player 1 here, which is always you when using "New Game"):
equip 1 51 // ID
equip 1 "Molotov Cocktail" // full name
equip 1 ak47 // simplified name
equip 1 fiveseven // simplified name
equip 1 "Molotov Cocktail" // full name
equip 1 ak47 // simplified name
equip 1 fiveseven // simplified name
Note: When using equip, a player can carry multiple different primary and secondary weapons. This is not possible when simply collecting weapons in-game.
Note: A player can hold each weapon only one time. Equip the same weapon again to re-fill the ammunition of this weapon.
Attention: NEVER use the equip command in Lua spawn hooks! Spawn performs its own equips which can lead to problems. Use the return value of your hooked spawn function instead! Put the following at the end of the function:
return "weaponid,weaponid,weaponid,..."
with weaponid = type id of weapons you want to equip
return "weaponid,weaponid,weaponid,..."
with weaponid = type id of weapons you want to equip