Raised This Month: $ Target: $400
 0% 

Detecting MOTD


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-13-2012 , 14:23   Detecting MOTD
Reply With Quote #1

Since 6,082 minds are better than one, I thought I'd open this up for a brief discussion.

As a few people know, if someone is viewing an MOTD page and dies, the page gets refreshed. This can get incredibly annoying at times, so of course the best route is to block whatever is causing this.

It seems the reason for this is the specgui VGUIMenu usermessages. Blocking this completely stops the MOTD from refreshing however this has its problems. The specgui is responsible for the grey bars top and bottom when you die, and is the basis for specmenu which handles the respawn countdown amongst other things, so blocking this hides all respawn info which is also not desired.

As far as I know, there is no way to detect when the MOTD closes, so I'm having to look down alternative routes. My current way is to use OnPlayerRunCmd to detect when the player is moving - if they're moving they've very likely closed the MOTD. However I definitely don't like using this in what's supposed to be a lightweight plugin.

Can any of you suggest other solutions to block specgui when in MOTD, and unblock it when not?
__________________
11530 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-13-2012 , 18:01   Re: Detecting MOTD
Reply With Quote #2

I've never witnessed the MOTD refreshing on death.
__________________

Last edited by Dr. McKay; 05-13-2012 at 18:02.
Dr. McKay is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-13-2012 , 18:25   Re: Detecting MOTD
Reply With Quote #3

Perhaps you're one of the lucky few, try using the kill command whilst in !bp or something.

Bottiger talks about the problem here but describes similar procedures.
__________________

Last edited by 11530; 05-13-2012 at 18:28.
11530 is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 05-13-2012 , 18:29   Re: Detecting MOTD
Reply With Quote #4

Quote:
Originally Posted by 11530 View Post
Perhaps you're one of the lucky few, try using the kill command whilst in !bp or something.
Well, I use my SMDJ plugin all the time, which opens a music player in the MOTD browser. When I die, the song doesn't restart.
__________________
Dr. McKay is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-13-2012 , 18:32   Re: Detecting MOTD
Reply With Quote #5

*scratches head*

I'm at a loss. It can't just be me and bottiger (and a third) who have these problems. Can anyone else confirm this on their box?
__________________

Last edited by 11530; 05-13-2012 at 18:36.
11530 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-13-2012 , 18:41   Re: Detecting MOTD
Reply With Quote #6

Quote:
Originally Posted by 11530 View Post
As far as I know, there is no way to detect when the MOTD closes
Sure there is.

In the VGUIMenu message for the MotD, you can send a "cmd" key with a value for whatever command you want to be executed when the client closes the menu.

On Source 2009 games (TF2, CS:S, DODS, HL2DM) and Nuclear Dawn, it takes an int value.

From Dynamic MOTD:
Code:
enum /* Ep2vMOTDCmd */ {     Cmd_None,     Cmd_JoinGame,     Cmd_ChangeTeam,     Cmd_Impulse101,     Cmd_MapInfo,     Cmd_ClosedHTMLPage,     Cmd_ChooseTeam, };

You would sent Cmd_ClosedHTMLPage (5), and add a command listener for "closed_htmlpage".

On other games, you can give a string for the "cmd" value with the command of your choosing. Register your own command to use for it.
psychonic is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 05-13-2012 , 21:50   Re: Detecting MOTD
Reply With Quote #7

Quote:
Originally Posted by psychonic View Post
Sure there is.

In the VGUIMenu message for the MotD, you can send a "cmd" key with a value for whatever command you want to be executed when the client closes the menu.

On Source 2009 games (TF2, CS:S, DODS, HL2DM) and Nuclear Dawn, it takes an int value.

From Dynamic MOTD:
Code:
enum /* Ep2vMOTDCmd */ {     Cmd_None,     Cmd_JoinGame,     Cmd_ChangeTeam,     Cmd_Impulse101,     Cmd_MapInfo,     Cmd_ClosedHTMLPage,     Cmd_ChooseTeam, };

You would sent Cmd_ClosedHTMLPage (5), and add a command listener for "closed_htmlpage".

On other games, you can give a string for the "cmd" value with the command of your choosing. Register your own command to use for it.
You, sir, are a god. Thank you.

There were many threads around, all asking similar questions to different ends, and every single one ended with a resounding 'no' amongst everyone. Never did I actually think that a 'yes' would emerge.

May I ask where you found this information please? If it's in the API Docs then it was certainly well hidden from myself and others, and Google only presents us with two results (both the same thread).
__________________
11530 is offline
psychonic

BAFFLED
Join Date: May 2008
Old 05-13-2012 , 21:53   Re: Detecting MOTD
Reply With Quote #8

Quote:
Originally Posted by 11530 View Post
May I ask where you found this information please? If it's in the API Docs then it was certainly well hidden from myself and others, and Google only presents us with two results (both the same thread).
The MotD having a "cmd" key is in the source sdk. The changing of it from a string to an int on Source 2009, as well as the new values for it were in CS:S update news long ago.
psychonic is offline
Reply



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

Forum Jump


All times are GMT -4. The time now is 07:59.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode