You can do all that with the one function that I modified in my post there.

#include "trgamerules.h" <-- or whatever your header is.

void CHL2MPTextWindow::OnCommand( const char *command)
{
   if (!Q_strcmp(command, "okay"))
   {
if ( m_szExitCommand[0] )
{
engine->ClientCmd( m_szExitCommand );
}
//only change between the default one and this? Show the team menu when we
close! :)
    if ( TRGameRules()->GetGameRules() == MODE_SS )
    {
                m_pViewPort->ShowPanel("squadteam", true );
    }
        else if ( TRGameRules()->GetGameRules() == MODE_TS )
    {
                m_pViewPort->ShowPanel("team", true );
    }
m_pViewPort->ShowPanel( this, false );
}

As long as you network the variable GetGameRules() uses.

-----Original Message-----
From: r00t 3:16 [mailto:[EMAIL PROTECTED]
Sent: May 22, 2005 7:09 PM
To: [email protected]
Subject: Re: [hlcoders] catching the OK click on the MOTD? -- ignore
previous post.

How I did mine is like this. Not sure if this is the best way but it works.
Not sure how to do it just in the client project because I need to access
what Game Mode is on.
in hl2mp_client.cpp
Where the motd loads up.
data->SetString( "cmd" , "motd_closed");

in hl2mp_player.cpp
CHL2MP_Player::ClientCommand()

if ( FStrEq( cmd, "motd_closed" ) )
{

    if ( TRGameRules()->GetGameRules() == MODE_SS )
    {
        ShowViewPortPanel("squadteam", true );
    }
        else if ( TRGameRules()->GetGameRules() == MODE_TS )
    {
        ShowViewPortPanel("team", true );
    }

     return true;
}

I thought I tried the exact same thing last night but I guess not...


r00t 3:16
CQC Gaming
www.cqc-gaming.com
----- Original Message -----
From: "Tony "omega" Sergi" <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Sunday, May 22, 2005 9:24 AM
Subject: RE: [hlcoders] catching the OK click on the MOTD? -- ignore
previous post.


>K so it was way easier than I thought it was.
> Disregard all the other code I had posted then just do this:
> Add virtual void OnCommand( const char *command); to CHL2MPTextWindow.
> then in the cpp
> void CHL2MPTextWindow::OnCommand( const char *command)
> {
>    if (!Q_strcmp(command, "okay"))
>    {
> if ( m_szExitCommand[0] )
> {
> engine->ClientCmd( m_szExitCommand );
> }
>
> //only change between the default one and this? Show the team menu when we
> close! :)
>
> m_pViewPort->ShowPanel( PANEL_TEAM, true );
> m_pViewPort->ShowPanel( this, false );
> }
>
> BaseClass::OnCommand(command);
> }
>
>
> -----Original Message-----
> From: Tony "omega" Sergi [mailto:[EMAIL PROTECTED]
> Sent: May 22, 2005 8:58 AM
> To: [email protected]
> Subject: RE: [hlcoders] catching the OK click on the MOTD?
>
> I used what I call a "server side hack" to workaround the motd problem. I
> call it a hack because the more I've been playin with vgui2 now, I realize
> there's probably better ways to do it. Anyway, here's what I did:
>
> I added a bool to Cbaseplayer, " bMOTDActive"
> Then added a client command under gamerules called "motd_closed"
> Then in the message to show the motd, I set
> data->SetString( "msg", "motd" ); // use this
> stringtable entry
> data->SetString( "cmd", "motd_closed" );// exec this command when
> panel closed
>
> pPlayer->bMOTDActive = true; //TODO omega; need to check if motd.txt
> exists, if it doesn't, don't bother sending teh MOTD menu
>
> then in my playerspawn function:
> //omega; if the motd hasn't been shown, then we need to draw
> the team menu
> if (!pPlayer->bMOTDActive)
> pPlayer->ShowViewPortPanel("team", true);
>
> and the client command:
> if ( FStrEq( cmd, "motd_closed") )
> {
> ShowViewPortPanel("team", true);
> return TRUE; //omega; added to show the team menu after the
> MOTD is closed
> }
>
> That's about it.
>
> Could probably do all that on the client (let the other menus open, just
> hide them when the motd is open instead) but when I did this, I wasn't
> sure
> (well to tell the truth, I'm still not sure how to do it properly ;))
>
>
> -----Original Message-----
> From: r00t 3:16 [mailto:[EMAIL PROTECTED]
> Sent: May 22, 2005 12:25 AM
> To: [email protected]
> Subject: [hlcoders] catching the OK click on the MOTD?
>
>
> Sorry if this was asked before...
> I am not quite sure how to catch this to see if the button is clicked so I
> can bring up the team menu.
>
> Would I do it in the ConCommand() where the okay is specified then use
> something like
> m_pViewPort->ShowPanel( ???, true );
> Or should I add this in the ClientCommand of CHL2MP_Player ?
>
> I actually tried catching the okay in the ClientCommand of
> CHL2MP_Player::ClientCommand() but it did not work.
>
>
>
> r00t 3:16
> CQC Gaming
> www.cqc-gaming.com
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.15 - Release Date: 22/05/2005
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.15 - Release Date: 22/05/2005
>
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
>
> --
> No virus found in this incoming message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.15 - Release Date: 22/05/2005
>
>
> --
> No virus found in this outgoing message.
> Checked by AVG Anti-Virus.
> Version: 7.0.308 / Virus Database: 266.11.15 - Release Date: 22/05/2005
>
>
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives,
> please visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
>


_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives,
please visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders



--
No virus found in this incoming message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.15 - Release Date: 22/05/2005


--
No virus found in this outgoing message.
Checked by AVG Anti-Virus.
Version: 7.0.308 / Virus Database: 266.11.15 - Release Date: 22/05/2005



_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to