Re: [hlcoders] catching the OK click on the MOTD?

2005-05-22 Thread NuclearFriend
--
[ Picked text/plain from multipart/alternative ]
http://list.valvesoftware.com/mailman/private/hlcoders/2005-April/013241.html

Simply send a ClientCommand call in the OnCommand or do it all client-side
and make the teammenu visible in OnCommand.

On 5/22/05, r00t 3:16 [EMAIL PROTECTED] wrote:


 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 http://www.cqc-gaming.com


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




--
Programmer for RnL
www.resistanceandliberation.com http://www.resistanceandliberation.com
--

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



RE: [hlcoders] catching the OK click on the MOTD?

2005-05-22 Thread Alfred Reynolds
Doing it clientside would be highly recommended (the latency introduced
by bouncing the command via the server is very undesirable).

- Alfred

Original Message
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
NuclearFriend Sent: Sunday, May 22, 2005 12:31 AM To:
hlcoders@list.valvesoftware.com Subject: Re: [hlcoders] catching the OK
click on the MOTD?

 --
 [ Picked text/plain from multipart/alternative ]

http://list.valvesoftware.com/mailman/private/hlcoders/2005-April/013241
.html

 Simply send a ClientCommand call in the OnCommand or do it all
 client-side and make the teammenu visible in OnCommand.

 On 5/22/05, r00t 3:16 [EMAIL PROTECTED] wrote:
 
 
  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 http://www.cqc-gaming.com
 
 
  ___
  To unsubscribe, edit your list preferences, or view the list
  archives, please visit:
  http://list.valvesoftware.com/mailman/listinfo/hlcoders
 
 


 --
 Programmer for RnL
 www.resistanceandliberation.com
 http://www.resistanceandliberation.com

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



RE: [hlcoders] catching the OK click on the MOTD?

2005-05-22 Thread Tony \omega\ Sergi
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: hlcoders@list.valvesoftware.com
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



RE: [hlcoders] catching the OK click on the MOTD? -- ignore previous post.

2005-05-22 Thread Tony \omega\ Sergi
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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



Re: [hlcoders] catching the OK click on the MOTD? -- ignore previous post.

2005-05-22 Thread r00t 3:16

I was trying different things, I had something similar to what omega had but
it wasn't working for some reason...

I actually had the code like the below,  however I am not sure if it is
possible to access the game rules info from within the panel class.
Reason for this is because depending on the game mode a different panel
would open.

r00t 3:16
CQC Gaming
www.cqc-gaming.com


- Original Message -
From: Tony omega Sergi [EMAIL PROTECTED]
To: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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



Re: [hlcoders] catching the OK click on the MOTD? -- ignore previous post.

2005-05-22 Thread r00t 3:16

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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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



RE: [hlcoders] catching the OK click on the MOTD? -- ignore previous post.

2005-05-22 Thread Tony \omega\ Sergi
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
 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: hlcoders@list.valvesoftware.com
 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

Re: [hlcoders] catching the OK click on the MOTD? -- ignore previous post.

2005-05-22 Thread r00t 3:16

Thank you omega.
I do not have that variable networked atm.

r00t 3:16
CQC Gaming
www.cqc-gaming.com
- Original Message -
From: Tony omega Sergi [EMAIL PROTECTED]
To: hlcoders@list.valvesoftware.com
Sent: Sunday, May 22, 2005 8:05 PM
Subject: RE: [hlcoders] catching the OK click on the MOTD? -- ignore
previous post.



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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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: hlcoders@list.valvesoftware.com
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

[hlcoders] catching the OK click on the MOTD?

2005-05-21 Thread r00t 3:16


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