Search
Username:
Password:

Register or Reset Password

SUBMISSIONS
Counter Strike
   New Maps
   New Tutorials
   New Skins
   New GUI's
   New Sounds
   New Threads
Other
   Media
   Gamers
   Clans
   Studios
Custom text menus with subcategories!
Difficulty: Advanced
Category: CS:S > ScriptingAuthor(s): J2K

The following tutorial will explain every step of creating a custom menu in Counter-Strike Source.

I have included a simplified version of my personal menu with comments throughout it to help you understand the workings of this script.

The first few steps may seem confusing but are necessary preparation for creating your menu. It will all make sense in the end.

Each step is written in yellow.
Notes explaining each section are written in cyan.
From this point on, white text can be copy pasted into config files as it is commented.

Step 1). Big fancy banner labelling each segment of your script!
//=================================
//Big fancy banner by J2K!
//=================================

The double slash is known as a comment. Anything following a // is ignored by CS: Source until the next line without a double slash.

Feel free to design your own fancy banner to organise your script as long as it follows a double slash (:


Step 2). Once you have finished with your custom menu and wish to return to playing the game, you will need the following bind to return your number bindings to default. Otherwise changing weapons will result in the game trying to use your custom menu still!
//=================================
//Reset binds after using menus
//=================================

alias keyreset "bind 0 slot0; bind 1 slot1; bind 2 slot2; bind 3 slot3; bind 4 slot4; bind 5 slot5;"

This rebinds the 5 weapon slots and the menu cancel button. We will use it at the end of each menu selection later on.

Step 3). These two commands will enable and disable the menus on screen when needed.
//=================================
//Settings for echo commands
//=================================

alias ActivateEcho "developer 1; contimes 10; con_notifytime 40;"
alias DeactivateEcho "keyreset; clear; developer 0; contimes 0; con_notifytime 0;"

developer 1 - Shows console messages in the top left of screen.
contimes 10 - Maximum number of menu items to display simultaneously.
con_notifytime 40 - Time in seconds that the menu is displayed for.
DeactivateEcho - Calls upon our earlier command keyreset to rebind our weapon changing keys. Also clears the console and turns off any active menus.


Step 4). These are the commands and settings that will be associated with our menu selections.
//=================================
//Option menu scripts
//=================================

//Main option menu
alias NameChooser "DeactivateEcho; ActivateEcho; NameList;"
alias RateMenu "DeactivateEcho; ActivateEcho; RateList;"

The above commands turn off the original menu, then activate the appropriate submenu.

//Name chooser menu
alias Name1 "name oNe MaN aRMy GuNs CaNT HaRM Me; DeactivateEcho;"
alias Name2 "name FeeL My PiMP HaND!; DeactivateEcho;"
alias Name3 "name tHe uNCHoSeN oNe; DeactivateEcho;"

Substitute the above names with 3 of your own. These 3 commands are linked to the NameChooser menu. When selected, they clear the menu from screen, and rebind your weapon changing keys.

//Rates option menu
alias TickRate33 "rate 20000; cl_cmdrate 33; cl_updaterate 33; cl_interp_ratio 3; DeactivateEcho;"
alias TickRate66 "rate 20000; cl_cmdrate 66; cl_updaterate 66; cl_interp_ratio 1.5; DeactivateEcho;"
alias TickRate100 "rate 20000; cl_cmdrate 100; cl_updaterate 100; cl_interp_ratio 1; DeactivateEcho;"

These are 3 sets of rates i use depending on the tickrate of the server i am playing. They are correct based on Valve's client rates articles in their support section at SteamPowered.

Step 5). These are the new bindings for the weapon selection keys, a different set of bindings for each menu you choose.
//=================================
//The key sets
//=================================

//Main menu key set
alias SetKeysToMain "bind 1 NameChooser; bind 2 RateMenu; bind 0 DeactivateEcho;"

//Name menu key set
alias SetKeysToNames "bind 1 Name1; bind 2 Name2; bind 3 Name3; bind 0 DeactivateEcho;"

//Rates menu key set
alias SetKeysToRates "bind 1 TickRate33; bind 2 TickRate66; bind 3 TickRate100; bind 0 DeactivateEcho;"

Step 6). The actual menus themselves using echo commands.
//=================================
//The on screen menus
//=================================

//Main menu
alias MainMenu "ActivateEcho; echo J2K's CS: Source options; echo 1) Name chooser; echo 2) Rates; echo 3) Scripts menu; echo 0) Cancel; SetKeysToMain;"

//Names menu
alias NameList "echo Choose a name; echo 1) oNe MaN aRMy GuNs CaNT HaRM Me; echo 2) FeeL My PiMP HaND!; echo 3) tHe uNCHoSeN oNe; echo 0) Cancel; SetKeysToNames;"

Don't forget to change these 3 names to the same names you used earlier in this script!

//Rates menu
alias RateList "echo Choose the server tickrate; echo 1) Tickrate 33; echo 2) Tickrate 66; echo 3) Tickrate 100; echo 0) Cancel; SetKeysToRates;"

//Script menu
alias ScriptList "echo Choose a script; echo 1) Dual elites rapid fire; echo 2) Psychadelic crosshair; echo 0) Cancel; SetKeysToScripts;"

//Bind the main menu to a key of your choice and you are done!
bind f1 MainMenu

Finally, the first thing you see in game is the last thing you coded!

It is all coming together now! Try to stay with me as i explain this as a whole :P

The first thing you see is the MainMenu. Once it has been displayed, the command SetKeysToMain is executed. If you scroll up the page you will see it binds the number keys to each part of the menu you see.

Pressing 0 will cancel any menu and return controls to default.

Choosing a menu will then clear the current menu, and launch the one you chose, followed by a new SetKeys command. Which binds your next set of options (:

Once you choose a setting such as a name change, the menus are cleared and controls returned to default for you to play!


Well, i hope this has helped you with menus and made you want to make some of your own, has been a fun challenge programming this ^_^

Oh and one more thing before i forget! Valve has recently decided developer 1 is a cheat cvar (it can be exploited).

This means you can only use this menu on LAN and servers running sv_cheats 1. This should only be temporary as me and many others have posted in this forum about the issue. Join in the forum chat and support us in getting this menu functional on all servers again!

Good luck have fun!

Jay.
Added: 1 year agoTags: text, menu, gui
Feedback (8)
.
FDArts.urli.netY2M
Posted 2 months ago
It kinda does matter :P since its kinda spam but still if others in future wonder too atleast they'll know, i got the answer ages ago :D
paperman12 .
PapermanY2M
Posted 2 months ago
Posted by FallDown

Posted by paperman12

Posted by FallDown

Where do you save all the text? what kinda file and wich folder?


Ok this is what I am guessing:

You save the file as a .cfg and put it in the cfg folder located in cstrike. After that, you add the line:

"exec yourfilename.cfg"

(without quotes) in your autoexec.cfg or server.cfg.


you seriously answered 8 months old post? WHY??!?!?!


.... does it matter? I didnt see that it was 8 months ago.
.
FDArts.urli.netY2M
Posted 2 months ago
Posted by paperman12

Posted by FallDown

Where do you save all the text? what kinda file and wich folder?


Ok this is what I am guessing:

You save the file as a .cfg and put it in the cfg folder located in cstrike. After that, you add the line:

"exec yourfilename.cfg"

(without quotes) in your autoexec.cfg or server.cfg.


you seriously answered 8 months old post? WHY??!?!?!
paperman12 .
PapermanY2M
Posted 2 months ago
Posted by FallDown

Where do you save all the text? what kinda file and wich folder?


Ok this is what I am guessing:

You save the file as a .cfg and put it in the cfg folder located in cstrike. After that, you add the line:

"exec yourfilename.cfg"

(without quotes) in your autoexec.cfg or server.cfg.
.
FDArts.urli.netY2M
Posted 10 months ago
Where do you save all the text? what kinda file and wich folder?
Fresh lemon .
Proud to be swedish.Y2M
Posted 1 year ago
Very helpfull.. i say NIIIIIIICE....
.
Scripting & Tutorial MasterY2M
Posted 1 year ago
All is well! Enjoy peoples!
.
Scripting & Tutorial MasterY2M
Posted 1 year ago
Gimme a few minutes to figure out where my html went wrong hehe won't be long til this is good again (:
Add Feedback
Provide constructive feedback. What is "constructive"?
You cannot post yet!
Get involved on FPSB by posting your thoughts. Give authors your feedback to help them develop.

To post in this submission register or login.
Assessment
The community's verdict.
User Rating [+]
10/10
bScore
10.0/10
You cannot assess yet!
Moderating FPSB is in your hands - when you assess a submission your vote determines its success or failure.

To vote on this submission register or login.
Stamps
This Tutorial in a nutshell...
Helpful & Useful
You cannot stamp yet!
Stamps let you apply characteristics to submissions to help others understand them.

To stamp this submission register or login.

Brought to you by...
Sabotage Studios
Originality, Creativity, Simplicity
Membership: On Request
Primary Skills: ?
Inception: 2 years ago
Vote for Studio
Like this tut? Vote Sabotage Studios for one or more monthly awards.
You must login or register to access this!
Related Tutorials