Old 01-10-2010, 02:00 PM   #1
Super Moderator
 
Zombi's Avatar
 
Join Date: Dec 2009
Posts: 221
Thanks: 35
Thanked 116 Times in 67 Posts
Rep Power: 7
Zombi will become famous soon enough
Zombi is offline

Default [Tut]Custom Counter-Strike Source Game Menus


f you have any problems contact me on steam:
doogiehoogie

Lets start by getting the first raw things out of the way. Creating the file, to do this follow these steps:
1. Open NotePad Or A text editor
2. save file to: Steamapps/ACCname/Counter-Strike Source/Cstrike/Resource
3. File name: Gamemenu.res
4. Add the following:


Code:
"GameMenu"
{

}

3.After that was added, save the file as Gamemenu.RES
4.(optional) If you have pride and want the people who edit these to know who made the file add this:
//Made by TopHATTWaffle

"//" That means to comment out, if you ever are working with code in CSS "//" means to comment

Now for the menu code
This is the Shell of a command:
"1"
{
"label" ""
"command" ""
"OnlyInGame" ""
}

Its pretty simple, but here is a break down
"1" This is just to keep your place, it does not really matter. just helps

{
} These are Open and close brackets, they let the game know when a new command starts and ends. these must be here

"Label" "" This is the name of your item, Example. if you want "Find Counter-Strike servers" to show up this is what you would have
"Label" "Find Counter-Strike servers"

"Command" "" This is what gets fired when you click the button

"OnlyInGame" "" This tell the game if it should only show when you are in a server. "1" means yes, "0" means no. Wouldn't want to disconnect from nothing would we?

All commands will go between:

"gamemenu"
{

}

Example:

"gamemenu"
{


"1"
{
"label" "Hello World"
"command" "engine showconsole;echo Hello world"
"OnlyInGame" "0"
}

}


To make a custom command do this
1. Paste the following

"1"
{
"label" ""
"command" ""
"OnlyInGame" ""
}

2. Change number to keep your sanity
3. Input your Command name Example: "Open Console"
4. Input your command, this is where it gets tricky.
To open the console with a button click it is this command:showconsole
But if we have: "command" "showconsole" you'll just have a dead button to click when your bored.
to make it work you have to let the game know to fire it to the source engine, so the proper command would be:"command" "engine showconsole"
5. Choose ingame, or not ingame

To fire more then one command
each command must be seperated by a ";" To have a hello world button, a person would have

"1"
{
"label" "Hello World"
"command" "engine showconsole;echo Hello world"
"OnlyInGame" "0"
}

"echo" tells the game to display the text that follows.

To have a toggle
To have a button that toggles thought a set number of settings Example: cl_crosshairscale 500, and cl_crosshairscale 1200
the command would be:

"1"
{
"label" "Change Crosshair"
"command" "engine toggle cl_crosshairscale 500 1200"
"OnlyInGame" "0"
}

With toggles, you can have more then one command, one command on a toggle is the limit, so you cant have:

"command" "engine toggle cl_crosshairscale 500 1200;Sv_cheats 1 0"

That will not work, and you will have a dead button

to have a blank spot input the following


"1"
{
"label" ""
"command" ""
"OnlyInGame" ""
}

Seriously, NOTHING is for NOTHING who would have known?

To have a nice space line like i have you would have this:

"1"
{
"label" "=-=-=-=-=-=-=-="
"command" "Spacer"
"OnlyInGame" "1"
}

Spacer tells the game that its just to space stuff apart.

Wile making a custom command rember the following
1. You cant have more then 1 command in a toggle
2. Your spelling must be perfect
3. Commands do fire in order listed Example:

"Command" "engine sv_cheats 1;Mat_wireframe 1;mat_leafvis 1"

Sv_cheats get fired before Mat_wireframe

4. The number dosent put the buttons in order, where they are in the text file does Example:

"2"
{
"label" "#GameUI_GameMenu_ResumeGame"
"command" "ResumeGame"
"OnlyInGame" "1"
}
"1"
{
"label" "#GameUI_GameMenu_Disconnect"
"command" "Disconnect"
"OnlyInGame" "1"

Even though Disconnect is "1" it will be after ResumeGame, because it is after it on the list

5.Some commands just dont work, if so just make a bind.
6.Dont go over board, if you have too many commands CSS will put a scroll bar for your menu, if so jsut remove some commands and make some binds.

Console Effect commands

Echo - Display Text on next line Example: "command" "engine echo Hello;echo world"
would display as:
Hello
world

Clear - Clear All text in console
showconsole - Shows console, Put this at front of command if you have text effects

Some commands every menu should have
What the commands are By number:
1. Resume Game
2. Disconnect
3. Player list
15. Find servers
16. CreateServer
19. Video Stress Test
20. Options
21. Quit

"1"
{
"label" "#GameUI_GameMenu_ResumeGame"
"command" "ResumeGame"
"OnlyInGame" "1"
}
"2"
{
"label" "#GameUI_GameMenu_Disconnect"
"command" "Disconnect"
"OnlyInGame" "1"
}
"3"
{
"label" "#GameUI_GameMenu_PlayerList"
"command" "OpenPlayerListDialog"
"OnlyInGame" "1"
}
"15"
{
"label" "#GameUI_GameMenu_FindServers"
"command" "OpenServerBrowser"
}
"16"
{
"label" "#GameUI_GameMenu_CreateServer"
"command" "OpenCreateMultiplayerGameDialog"
}

"19"
{
"label" "#GameUI_LaunchBenchmark"
"command" "OpenBenchmarkDialog"
}
"20"
{
"label" "#GameUI_GameMenu_Options"
"command" "OpenOptionsDialog"
}
"21"
{
"label" "#GameUI_GameMenu_Quit"
"command" "engine quit"
}

These are the commands that Counter Strike comes with.

Commands that are good for Dev
What the commands are By number:
5. Enable sv_cheats, Turn on wire frame, enable Visleafs
6. Disable sv_cheats, Turn off wire frame, disable Visleafs

"5"
{
"Label" "Enable Dev Mode"
"Command" "engine sv_cheats 1;Mat_wireframe 1;mat_leafvis 1"
"OnlyInGame" "1"
}
"6"
{
"Label" "Disable Dev Mode"
"Command" "engine Mat_wireframe 0;mat_leafvis 0;sv_cheats 0"
"OnlyInGame" "1"
}


Commands that are good for Screen Shots
What the commands are By number:
7. Remove Hud, Crosshair, and weapon
8. Enable Hud, Crosshair, and weapon

"7"
{
"Label" "Enable ScreenShot Mode"
"Command" "engine sv_cheats 1;Cl_drawhud 0;Impulse 200;cl_crosshairalpha 0"
"OnlyInGame" "1"
}
"8"
{
"Label" "Disable ScreenShot Mode"
"Command" "engine Cl_drawhud 1;Impulse 200;sv_cheats 1;cl_crosshairalpha 255"
"OnlyInGame" "1"
}


Some good prebuilt commands
What the commands are By number:
1. Connect to Server
2. Show console with Text effect
3. Reconnect to last server
4. NetGraph Toggle
5.


"1"
{
"label" "Connect to *ServerName*"
"Command" "engine connect ###.###.###.###:27015"
"OnlyInGame" "0"
}
"2"
{
"label" "> CONSOLE ON/OFF<"
"command" "engine toggleconsole;echo -------------------------------------;echo | ------------ CONSOLE ------------ |;echo -------------------------------------"
"OnlyInGame" "0"
}
"3"
{
"label" "Reconnect"
"command" "engine retry"
"OnlyInGame" "0"
}
"4"
{
"label" "NetGraph"
"command" "engine toggle net_graph 0 3"
"OnlyInGame" "0"
}
"5"
{
"label" "Demo UI"
"command" "engine demoui"
"OnlyInGame" "0"
}


This was my quick tutorial on making a custom game menu, to see a prebuilt GameMenu go to the link below

http://files.tophattwaffle.com/Game%20Related/GameMenu.res
__________________
ZOMBI
[Only registered and activated users can see links. ]----

 
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.5.0 RC2