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
Category: player (56)
- assist
- attack
- attack2
- bombdefuse
- bombexplode
- bombplant
- build
- buildattempt
- buy
- clientdata
- clientsetting
- collect
- connect
- connect_attempt
- connect_initplayer
- die
- disconnect
- dominate
- drop
- flagcapture
- flagtake
- flashlight
- hit
- hostagedamage
- hostagekill
- hostagerescue
- hostageuse
- itemfadeout
- join
- key
- kill
- leave
- menu
- move
- movetile
- name
- radio
- reload
- say
- sayteam
- sayteamutf8
- sayutf8
- select
- serveraction
- shieldhit
- spawn
- specswitch
- spray
- suicide
- team
- use
- usebutton
- vipescape
- voice
- vote
- walkover
spawn
Categories
Parameters
- id: player id
Info
Whenever a player is spawned (hook is executed once for each spawn of each player). Spawns can occur in two different situations:
You can use the return value of this hook to influence with which weapons the player will be spawned. Just return a comma-separated string with the weapon IDs. Return nothing (or an empty string) to let the player spawn with the regular items (default behavior). Return just an "x" to spawn the player with melee weapon only (depends on game mode, knife in most modes).
Weapon and item IDs:
Sample: Always spawn all players with AK-47 (30), Desert Eagle (3) and HE (51)
- On roundstart (with preceding roundstart_prespawn hook and subsequent roundstart hook)
- After death or team switching in game modes with instant respawn (like deathmatch for instance)
You can use the return value of this hook to influence with which weapons the player will be spawned. Just return a comma-separated string with the weapon IDs. Return nothing (or an empty string) to let the player spawn with the regular items (default behavior). Return just an "x" to spawn the player with melee weapon only (depends on game mode, knife in most modes).
Weapon and item IDs:
Note: Hook order when starting a new round is:
- startround_prespawn
- spawn (once for each player)
- startround
Attention: Do NEVER use the "equip" command within this hook! It will probably lead to problems! Use the return value of the hook instead!
Sample: Always spawn all players with AK-47 (30), Desert Eagle (3) and HE (51)
addhook("spawn","sampleSpawn")
function sampleSpawn()
return "30,3,51,"
end
function sampleSpawn()
return "30,3,51,"
end
Return Values
- "": (nothing) spawn with regular items
- "x": spawn with melee weapon only
- "typeid,typeid,...": spawn with these items + melee