Splak.net

Home of .:Splak|
It is currently Sun Jun 16, 2024 2:42 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
PostPosted: Thu Jan 10, 2008 7:01 am 
Offline
Some kid.
Some kid.

Joined: Fri Sep 28, 2007 7:56 pm
Posts: 3256
Location: California, US
Counter-Strike: Condition Zero has supported this feature for a long time now, I've used it for quite a while, and would like to show you guys too :wink: .

So what exactly does this do? Well, here's a screenshot of what you can do with this feature.
Image
^^ Thats the menu some guy made for himself, I have the code for it, but I'm not just going to let you have it :? .

How to make it:

Well, the first thing that you are going to be wanting to do, is open up a fresh new document in Notepad. (Start -> All Programs -> Accessories -> Notepad).


The basic format that will be used within this file is:

Code:
"Bound Key" "Button Text" "Command To Be Executed"


You will see that again later.

You can have a maximum of 40 menus, and a maximum of 100 buttons per menu. These limits give you more than enough options for any CS command you could ever want in a GUI menu.

For this tutorial I will be creating a simple Settings Commandmenu script that does not need any other files to work properly.




Step 1: Identify your commands.
Identify what commands you want to use in the GUI menu. Pick out some settings that you will be using in your script and that you think would be beneficial to have in a GUI menu.

For this tutorial I will use the "volume" command and the "net_graph" command for the examples.


Step 2: Start coding! Add your main menus.
Each Main menu should be laid out in numerical order. Here we will add a menu for our first setting from Step #1 "volume". Since it is our first Main Menu, we will set the "Bound key" to "1" and label the Button Text as "Volume Adjuster".

At this time, open up a blank file with Notepad and insert the following text:

Code:
 "1" "Volume Adjuster"
 {

 }


Notice the brackets below the text. These must start and end your submenus like bookends. A left bracket is the starting bracket and the right bracket is the ending bracket. If you used this Menu in the game at this point, it would look like this:
Image


Step 3: Add Settings.
Now that we have added our first main menu "Volume Adjuster", we will add settings for this menu. Here we will input the text within the brackets and remember the standard format:

Code:
"Bound Key" "Button Text" "Command To Be Executed"


Now type (cut & paste) the following settings to your file:

Code:
 {
   "1" "Volume Off" "volume 0.0; dev1; echo Volume Muted; dev0"
   "2" "Volume 10%" "volume 0.1; dev1; echo 10% Volume; dev0"
   "3" "Volume 20%" "volume 0.2; dev1; echo 20% Volume; dev0"
   "4" "Volume 30%" "volume 0.3; dev1; echo 30% Volume; dev0"
   "5" "Volume 40%" "volume 0.4; dev1; echo 40% Volume; dev0"
   "6" "Volume 50%" "volume 0.5; dev1; echo 50% Volume; dev0"
   "7" "Volume 60%" "volume 0.6; dev1; echo 60% Volume; dev0"
   "8" "Volume 70%" "volume 0.7; dev1; echo 70% Volume; dev0"
   "9" "Volume 80%" "volume 0.8; dev1; echo 80% Volume; dev0"
   "0" "Volume 90%" "volume 0.9; dev1; echo 90% Volume; dev0"
   "-" "Volume Max" "volume 1.0; dev1; echo Max Volume; dev0"
 }


Notice that everything is contained in quotes and that each line starts with the "Bound Key", then the text that will be displayed on the button "Button Text", and finally the command that will be executed. Also, note that we inputted the settings within the original brackets. The in-game menu would now look like this:
Image


Step 4: Add another Main Menu.
At this time we will add another Main Menu to our file below the last bracket of the Volume Adjuster menu. This time we will use "2" for the bound key, since "1" is already used, and we will label this menu "Visual Settings". Type the following into your file:

Code:
 "2" "Visual Settings"
 {

 }



Step 5: Add a submenu.
Now for the first time we will add a menu below the Main menu before adding settings. This would be used if you wanted to organize your main menus into various submenus for ease of use. For example, you might have Main Menu labels for Buys, Settings, and Demos, and then have submenus in each of those that correspond with the main menu.

We will add a submenu in the same fashion as we added the main menu, except that we will add this menu within the brackets of the main menu. Here we will label the bound key as "1", since it is the first sub-menu in the "Visual Settings" main menu. We will give this menu a label of "Net Graph Settings". Now you can type the following (in bold) into your file:

Code:
 {

      "1" "Net Graph Settings"
      {

      }

 }


Notice that I indented the file to keep everything organized and in some sort of tabular format. This is not required, but is a good idea.


Step 6: Add settings.
Now that we have added our first sub menu "Net Graph Settings" we will add settings for this menu. Here we will input the text within the brackets and remember the standard format:

Code:
"Bound Key" "Button Text" "Command To Be Executed"


Now type (cut & paste) the following settings to your file:

Code:
 {

     "1" "Net Graph Off" "net_graph 0"
     "2" "Net Graph 1 On" "net_graph 1"
     "3" "Net Graph 2 On" "net_graph 2"
     "4" "Net Graph 3 On" "net_graph 3"
     "5" "Cancel "slot10"

 }

Notice that I added a cancel option with this menu to close the screen and cancel your choices.

At this point your file should look like this:

Code:
  "1" "Volume Adjuster"
  {
   "1" "Volume Off" "volume 0.0; dev1; echo Volume Muted; dev0"
   "2" "Volume 10%" "volume 0.1; dev1; echo 10% Volume; dev0"
   "3" "Volume 20%" "volume 0.2; dev1; echo 20% Volume; dev0"
   "4" "Volume 30%" "volume 0.3; dev1; echo 30% Volume; dev0"
   "5" "Volume 40%" "volume 0.4; dev1; echo 40% Volume; dev0"
   "6" "Volume 50%" "volume 0.5; dev1; echo 50% Volume; dev0"
   "7" "Volume 60%" "volume 0.6; dev1; echo 60% Volume; dev0"
   "8" "Volume 70%" "volume 0.7; dev1; echo 70% Volume; dev0"
   "9" "Volume 80%" "volume 0.8; dev1; echo 80% Volume; dev0"
   "0" "Volume 90%" "volume 0.9; dev1; echo 90% Volume; dev0"
   "-" "Volume Max" "volume 1.0; dev1; echo Max Volume; dev0"
  }
  "2" "Visual Settings"
  {
      "1" "Net Graph Settings"
      {
         "1" "Net Graph Off" "net_graph 0"
         "2" "Net Graph 1 On" "net_graph 1"
         "3" "Net Graph 2 On" "net_graph 2"
         "4" "Net Graph 3 On" "net_graph 3"
         "5" "Cancel" "slot10"
      }
  }




Each menu has a starting and ending bracket to include the submenus. Also, each menu has a "Bound Key" and "Button Text", while the actual settings include a "Bound Key", "Button Text", and the "Command To Be Executed".


Step 7: Saving and moving the file to the correct directory.
At this time our Commandmenu script is almost complete. Now that you have verified yours is correct, we will save the file. Since the file is a standard txt file, all you have to do is verify your spelling and save the file as:

commandmenu.txt

After this file has been saved, move it to you "czero" folder (C:\Program Files\Valve\Steam\steamapps\*username*\condition-zero\czero) and start up Counter-Strike: Condition Zero (restart if already started).


Step 8: Binding the commandmenu.
The final step in creating a Commandmenu script is to bind a key to the command: +commandmenu. This is the command that will open up your Commandmenu script. To do this, open up your console(~) and type the following:

bind "o" "+commandmenu"


That's it! You are ready to go out and try your new Commandmenu Script. Also, you can add more menus and settings as you please to create your own custom Commandmenu Script.

-Good Luck!


Source: http://www.counter-script.net/index.php?id=21


Good coding habits:

•Use your space and TAB keys!!
Always leave good room and space to read through your work easily.


•Take your time.
Coding requires patience, if you rush through a project without even checking through it, you're bound to fall into a problem.


•USE QUOTES!!
Use quotes when defining commands, text, etc.


•Leave comments throughout your work.
Its great to leave comments to define what is going on in what area.

Example:
Code:
// Start visual settings code.
  "2" "Visual Settings"
  {
         "1" "Net Graph Settings"
      {
         "1" "Net Graph Off" "net_graph 0"
         "2" "Net Graph 1 On" "net_graph 1"
         "3" "Net Graph 2 On" "net_graph 2"
         "4" "Net Graph 3 On" "net_graph 3"
         "5" "Cancel" "slot10"
      }
  }
// End visual settings code code.


ANYTHING THAT BEGINS WITH '//' IS A COMMENT.



Have fun with this guys, if you figure it out, you have just learned basic CZ Scripting :D .

_________________
.:Splak|VMAN


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jan 10, 2008 10:21 am 
Offline
The British One
The British One
User avatar

Joined: Fri Sep 28, 2007 3:58 am
Posts: 4816
Location: England
I saw this awhile back on a website, but lookkeed wayyyy too confusing for my liking :lol: i stick with the normal stuff.

_________________
.:Splak|Stormzz
.:Splak|Fusionzz
[Splak Server Administrator]
[Recruitment Moderator and Co-Recruiter]
Image
Image
Got any questions? PM me and i'll try and help.

“You have enemies? Good. That means you've stood up for something, sometime in your life.” - Winston Churchill


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jan 10, 2008 11:46 am 
Offline
OMFG STEAM ROXORS TEH BIG ONE111
User avatar

Joined: Wed Sep 26, 2007 9:10 pm
Posts: 776
Awesome...

_________________
Image
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jan 10, 2008 2:41 pm 
Offline
Splakking Spree

Joined: Fri Sep 28, 2007 2:37 pm
Posts: 1367
Location: An igloo, clubbing cute innocent baby seals
already use cshelper :/

_________________
Fun Fact: "Beer Can" pronounced with an English Accent is "bacon" pronounced in Jamaican


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jan 10, 2008 2:43 pm 
Offline
of the Four Horsemen.
of the Four Horsemen.
User avatar

Joined: Thu Sep 27, 2007 5:14 pm
Posts: 2829
Location: South of Heaven
CSHelper and this are pretty useless. I find just typing in the commands in manually in console is much faster

_________________
Image


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Thu Jan 10, 2008 10:21 pm 
Offline
Listen up DOUCHE-FAG
Listen up DOUCHE-FAG
User avatar

Joined: Wed Sep 26, 2007 8:20 pm
Posts: 2499
Location: Brandon, MS
i'm not going to say useless, there is def. a place for it,


its just your personal preference.

i too prefer to use the "type in the command in console"

_________________
ImageImage

bob wrote:
Sorry,

my brother called you a retard.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Fri Jan 11, 2008 1:37 am 
Offline
Head Cheerleader
User avatar

Joined: Thu Sep 27, 2007 2:43 pm
Posts: 591
Location: San Marcos, TX
I like cshelper for the start of games i.e. key for nade, kev, kit, deg, etc... but I will not code outside of school. Java SUCKS.


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 12, 2008 12:27 am 
Offline
OMFG STEAM ROXORS TEH BIG ONE111
User avatar

Joined: Fri Sep 28, 2007 8:17 am
Posts: 776
Location: The closest thing to Canada in the US
Nevermind

The stuff you can create with just that is amazing. Just look at Runescape, granted its a boreing game, it a master piece of Javascript.

_________________
---.:Splak|Wonderguy---
---.:Splak|Shampoh---

Image

-—————— /´¯/)
-—————--/—-/
-—————-/—-/
———--/´¯/'--'/´¯`·_
———-/'/--/—-/—--/¨\
——-- ('(———- ¯~/'-')
——— \————-'—--/
———-'\'————-_-·´
————\———----(
————-\———--


Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: Sat Jan 12, 2008 10:08 am 
Offline
Mega Chuck Norris
Mega Chuck Norris
User avatar

Joined: Wed Sep 26, 2007 2:02 pm
Posts: 1153
Location: ATX
2MT

_________________
| .:Splak|PePTo |
Co-Leader

Image
Image
Image
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group