Counter-Strike 2DGet it now!

Code Command Reference

You can enter CS2D script commands in the console, save them in cfg-files or bind them to keys. CS2D script commands are no Lua commands but they can still be executed in Lua scripts by using the Lua parse-function!

Lua Lua Reference

Lua scripting (server-sided) allows server hosters and mappers to modify the game and to add new elements.

Lua Hooks


Lua Commands


Category: basic (11)


menu

Categories

Basic

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.
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! Each button caption can also be splitted into 2 parts by using "|" (scheme: "left caption|right caption"). Moreover you can put () around a button 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!

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