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: all (79)
- always
 - assist
 - attack
 - attack2
 - bombdefuse
 - bombexplode
 - bombplant
 - break
 - build
 - buildattempt
 - buy
 - clientdata
 - clientsetting
 - collect
 - connect
 - connect_attempt
 - connect_initplayer
 - die
 - disconnect
 - dominate
 - drop
 - endround
 - flagcapture
 - flagtake
 - flashlight
 - hit
 - hitzone
 - hostagedamage
 - hostagekill
 - hostagerescue
 - hostageuse
 - httpdata
 - itemfadeout
 - join
 - key
 - kill
 - leave
 - log
 - mapchange
 - menu
 - minute
 - move
 - movetile
 - ms100
 - name
 - objectdamage
 - objectkill
 - objectupgrade
 - parse
 - projectile
 - projectile_impact
 - radio
 - rcon
 - reload
 - say
 - sayteam
 - sayteamutf8
 - sayutf8
 - second
 - select
 - serveraction
 - shieldhit
 - shutdown
 - spawn
 - specswitch
 - spray
 - startround
 - startround_prespawn
 - suicide
 - team
 - trigger
 - triggerentity
 - turretscan
 - use
 - usebutton
 - vipescape
 - voice
 - vote
 - walkover
 
 
 name
Categories
Parameters
- id: player id
 
- oldname: old player name
 
- newname: new player name
 
- forced: was nickname forced by server command (0/1) or changed delayed (2)
 
Info
When the name of a player is being changed or a delayed name change is scheduled.
"forced" will be 0 if the name change was triggered by the player.
It will be 1 if the name change was forced by the server with the setname command.
In case it's a delayed name change because the player was dead while triggering it, "forced" will be 2 (read details below!).
Delayed Name Changing
If the name is changed by the player (not via setname) while being dead/not in a team, it will be delayed.
"forced" will be 0 if the name change was triggered by the player.
It will be 1 if the name change was forced by the server with the setname command.
In case it's a delayed name change because the player was dead while triggering it, "forced" will be 2 (read details below!).
Delayed Name Changing
If the name is changed by the player (not via setname) while being dead/not in a team, it will be delayed.
- The hook will be triggered instantly (with forced=0) when the dead player tries to change the name. This can be cancelled with return 1 (name change won't be scheduled then and the second hook call below won't be triggered). The name will NOT YET be changed at that point!
 - As soon as the player is alive again (with up to 1 sec delay) the name will be ACTUALLY changed. When this happens the hook will be triggered a second time but with forced=2. This can be cancelled with return 1 as well (name won't be changed then).
 
Note: Dead players can't change names instantly. If they try to do so their rename will be scheduled and executed later. The hook will be triggered 2 times (once for scheduling and once for actually changing the name) in that case. Read the explanation above!
Return Values
- 0: proceed normally
 
- 1: don't change name