class menu problem no2?

class menu problem no2?

Postby promith » Sun Sep 09, 2007 6:06 pm

Hiya ,

Ive got the class menu and teammenu working and they are fine but am wondering if there is anyway i can make the classmenu pop up after the teammenu closes at the moment i have to type chooseclass in console but would like it to open.I tried using
Code: Select all
engine->ServerCommand( "chooseclass\n" );
in my hl2mp_player.cpp file but it caused the class menu to pop on the server users screen everytime someone joined the server is there an easier way to do it?
promith
New Blood
 
Posts: 5
Joined: Mon Sep 03, 2007 11:30 am

Re: class menu problem no2?

Postby Bob » Sun Sep 09, 2007 9:46 pm

Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: class menu problem no2?

Postby promith » Mon Sep 10, 2007 12:10 am

where would i put the command to launch the new window in this code i tried adding show class menu code in here but got an error where the team menu popped up then when you chose team the classmenu popped up but when you picked a class the team menu popped up again . Sorrry for all the stupid questions but i am just learning to code and i know i am jumping in at the deepend but i find it the easiest way to learn.:)
promith
New Blood
 
Posts: 5
Joined: Mon Sep 03, 2007 11:30 am

Re: class menu problem no2?

Postby Bob » Mon Sep 10, 2007 12:15 am

Its not a stupid question, but your route is going to drive you a bit bonkers. If you look at that code you will see a function that is being called:

Code: Select all
void CTeamMenu::OnCommand( const char *command )
{
  if ( Q_stricmp( command, "vguicancel" ) )
  {
      if ( m_szExitCommand[0] )
      {
         engine->ClientCmd( m_szExitCommand );
      }
      engine->ClientCmd( const_cast<char *>( command ) );
  }
  Close();
  gViewPortInterface->ShowBackGround( false );
  BaseClass::OnCommand(command);
}


this is the process you should be looking for i do believe. When you close the one menu you trigger the command to open the other menu.
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California

Re: class menu problem no2?

Postby promith » Mon Sep 10, 2007 1:03 am

ahh right i get it so do i put the command in the function in the hl2mp_player.cpp file then where the function for join team is ? If this is right what command do i use to bring up the window if i use
Code: Select all
engine->ServerCommand( "chooseclass\n" );
this command i get the class menu showing up on the 2 clients in the server and when i use this code
Code: Select all
gViewPortInterface->ShowPanel( PANEL_CLASS, true );
i get these errors
.\hl2mp_dll\hl2mp_player.cpp(1014) : error C2065: 'gViewPortInterface' : undeclared identifier
.\hl2mp_dll\hl2mp_player.cpp(1014) : error C2227: left of '->ShowPanel' must point to class/struct/union/generic type
type is ''unknown-type''
.\hl2mp_dll\hl2mp_player.cpp(1014) : error C2065: 'PANEL_CLASS' : undeclared identifier
promith
New Blood
 
Posts: 5
Joined: Mon Sep 03, 2007 11:30 am

Re: class menu problem no2?

Postby Bob » Mon Sep 10, 2007 8:34 am

=\

The code i pasted above is part of the Team menu class, in the OnCommand function...

You may want to try doing more reading before you get too heavily into HL2. on a ten scale of complexity this is a 1 and there are much more difficult things in source that you will need to do more reading about in order to truly understand. you have a lot of things ahead of yourself, and i would highly suggest that you do about 10x more reading than code writing. Learning C++ while learning Source is not a possibility. Its got nothing to do with chance or whatever. You have to make educated guesses when you begin and eventually you will be thinking in source and able to throw things together in a night.

Go look through some of the other tutorials that are in source and let me know what your stance is on those. If you are still having problems getting through them, hit me up on AIM and we'll talk.
Bob
Site Admin
 
Posts: 252
Joined: Mon Nov 20, 2006 12:24 am
Location: San Jose California


Return to Game Development

Who is online

Users browsing this forum: No registered users and 1 guest

cron