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
itemfadeout
Categories
Parameters
- iid: item id
- type: item type
- xpos: item x position (tiles)
- ypos: item y position (tiles)
Info
When the droptimer of a dropped item reaches the value of mp_weaponfadeout (only in game modes which support item fade out).
In other words: When a dropped item is about to disappear with a fade out effect.
Weapon and item type IDs:
Sample 1: Create explosion at item fadeout position
Sample 2: Entirely disable all item fadeouts
In other words: When a dropped item is about to disappear with a fade out effect.
Weapon and item type IDs:
Note: This hook is only called before actually fading out an item. It is not called when item fade out is disabled or the game mode does not support item fade out.
Note: When returning 1 the droptimer value of the item will be set to 10000 to indicate that the item won't be faded out. The hook is not executed again for items with a droptimer of 10000.
Attention: When NOT returning 1 the item will be faded out DIRECTLY AFTER executing the hook. The item data won't be accessible any longer AFTER running the hook script!
Sample 1: Create explosion at item fadeout position
addhook("itemfadeout","itemfadeout")
function itemfadeout(iid, t, tileX, tileY)
local x = tileX * 32 + 16
local y = tileY * 32 + 16
local size = 64
local damage = 50
local srcPlayer = 0
parse("explosion "..x.." "..y.." "..size.." "..damage.." "..srcPlayer)
end
function itemfadeout(iid, t, tileX, tileY)
local x = tileX * 32 + 16
local y = tileY * 32 + 16
local size = 64
local damage = 50
local srcPlayer = 0
parse("explosion "..x.." "..y.." "..size.." "..damage.." "..srcPlayer)
end
Sample 2: Entirely disable all item fadeouts
addhook("itemfadeout","noitemfadeout")
function noitemfadeout(iid, t, tileX, tileY)
return 1
end
function noitemfadeout(iid, t, tileX, tileY)
return 1
end
Return Values
- 0: proceed normally (fade out the weapon)
- 1: don't fade out the weapon (droptimer will be set to 10000)