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
Lua Commands
Category: all (86)
- addbind
- addhook
- ai_aim
- ai_attack
- ai_build
- ai_buy
- ai_debug
- ai_drop
- ai_findtarget
- ai_freeline
- ai_goto
- ai_iattack
- ai_move
- ai_radio
- ai_reload
- ai_respawn
- ai_rotate
- ai_say
- ai_sayteam
- ai_selectweapon
- ai_spray
- ai_use
- checksumfile
- checksumstring
- closehostage
- closeitems
- closeobjects
- closeplayers
- entity
- entitylist
- fow_in
- freehook
- freeimage
- freetimer
- funcs
- game
- hascloseplayers
- hostage
- image
- imagealpha
- imageblend
- imagecolor
- imageframe
- imagehitzone
- imageparam
- imagepos
- imagescale
- inentityzone
- item
- itemtype
- map
- menu
- msg
- msg2
- object
- objectat
- objecttype
- parse
- player
- playerammo
- playerweapons
- projectile
- projectilelist
- randomentity
- randomhostage
- removeallbinds
- removebind
- reqcld
- reqhttp
- setentityaistate
- sethookstate
- stats
- steamstats
- tile
- tileproperty
- timer
- tween_alpha
- tween_animate
- tween_color
- tween_frame
- tween_move
- tween_rotate
- tween_rotateconstantly
- tween_scale
- vars
menuCategories
Parameters
- id
- "menu-content"
Info
Opens a menu on the screen of a certain player (id=player id) or at the screen of every player (id=0)!
The menu-content string defines the look and content of the menu. It's limited to 400 chars.
Scheme: "title,b1,b2,...,b9"
- title = title of the menu (Attach @b at the end of title for a bigger menu or @i for an invisible menu)
- b1-b9 = up to 9 button captions. Use empty strings for buttons you don't need. Captions can also be split into 2 parts by using "|" (scheme: "left caption|right caption"). Moreover you can put () around a caption to make a disabled button.
The menu-hook is executed when a player hits a menu button with the mouse or presses the corresponding numeric key.
Note: This command has just TWO (2) paramters! The first one is the player id and the second one a string which defines the contents of the menu!
Attention: The menu-content string is limited to a length of 400 chars!
Sample 1: A simple menu for player 1
menu(1,"Sample Menu With 3 Buttons,Button 1,Button 2,Button 3")
Sample 2: A big menu for player 2
menu(2,"Big Menu With 3 Buttons@b,Button 1,Button 2,Button 3")
Sample 3: A menu with a button left out (creating space between button 1 and 2)
menu(1,"Space,Button 1,,Button 2")
Sample 4: A menu with advanced button captions and a disabled button
menu(1,"Custom Buy Menu,Item 1|$5,Item 2|$50,(Item 3|$999999),Item 4|$0")
Sample 5: An invisible menu (can be used to capture hits of numeric keys)
menu(1,"Hidden@i,b1,b2,b3")
Sample 6: Processing menu actions using the menu-hook
addhook("menu","myMenu")
function myMenu(id,title,button)
msg("player "..player(id,"name").." has pressed button #"..button.." in the menu '"..title.."'!")
end
Categories
Parameters
- id
- "menu-content"
Info
Opens a menu on the screen of a certain player (id=player id) or at the screen of every player (id=0)!
The menu-content string defines the look and content of the menu. It's limited to 400 chars.
Scheme: "title,b1,b2,...,b9"
The menu-hook is executed when a player hits a menu button with the mouse or presses the corresponding numeric key.
Sample 1: A simple menu for player 1
Sample 2: A big menu for player 2
Sample 3: A menu with a button left out (creating space between button 1 and 2)
Sample 4: A menu with advanced button captions and a disabled button
Sample 5: An invisible menu (can be used to capture hits of numeric keys)
Sample 6: Processing menu actions using the menu-hook
The menu-content string defines the look and content of the menu. It's limited to 400 chars.
Scheme: "title,b1,b2,...,b9"
- title = title of the menu (Attach @b at the end of title for a bigger menu or @i for an invisible menu)
- b1-b9 = up to 9 button captions. Use empty strings for buttons you don't need. Captions can also be split into 2 parts by using "|" (scheme: "left caption|right caption"). Moreover you can put () around a caption to make a disabled button.
The menu-hook is executed when a player hits a menu button with the mouse or presses the corresponding numeric key.
Note: This command has just TWO (2) paramters! The first one is the player id and the second one a string which defines the contents of the menu!
Attention: The menu-content string is limited to a length of 400 chars!
Sample 1: A simple menu for player 1
menu(1,"Sample Menu With 3 Buttons,Button 1,Button 2,Button 3")
Sample 2: A big menu for player 2
menu(2,"Big Menu With 3 Buttons@b,Button 1,Button 2,Button 3")
Sample 3: A menu with a button left out (creating space between button 1 and 2)
menu(1,"Space,Button 1,,Button 2")
Sample 4: A menu with advanced button captions and a disabled button
menu(1,"Custom Buy Menu,Item 1|$5,Item 2|$50,(Item 3|$999999),Item 4|$0")
Sample 5: An invisible menu (can be used to capture hits of numeric keys)
menu(1,"Hidden@i,b1,b2,b3")
Sample 6: Processing menu actions using the menu-hook
addhook("menu","myMenu")
function myMenu(id,title,button)
msg("player "..player(id,"name").." has pressed button #"..button.." in the menu '"..title.."'!")
end
function myMenu(id,title,button)
msg("player "..player(id,"name").." has pressed button #"..button.." in the menu '"..title.."'!")
end