Raised This Month: $51 Target: $400
 12% 

Viewing Website in MOTD?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Snaggle
AlliedModders Donor
Join Date: Jul 2010
Location: England
Old 02-05-2013 , 04:20   Viewing Website in MOTD?
Reply With Quote #1

Not really Sourcemod scripting, but related.

How can I tell if a player is viewing a webpage from in game via the MOTD screen? I want to display certain text if they are, or hide it if they are not.
Snaggle is offline
PriceLess
Senior Member
Join Date: Sep 2012
Location: Jungle
Old 02-05-2013 , 04:42   Re: Viewing Website in MOTD?
Reply With Quote #2

Good question.

Isnt it easier to create two? Dont really know what its for, but sounds easier.
__________________
sincerely PriceLess

Last edited by PriceLess; 02-05-2013 at 04:43.
PriceLess is offline
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Old 02-05-2013 , 06:41   Re: Viewing Website in MOTD?
Reply With Quote #3

AFAIK there is no native / event for knowing when a player is viewing or has closed an MOTD screen. Would be useful though (or maybe there is and I just don't know about it).
__________________
Sheepdude is offline
psychonic

BAFFLED
Join Date: May 2008
Old 02-05-2013 , 07:27   Re: Viewing Website in MOTD?
Reply With Quote #4

Quote:
Originally Posted by Sheepdude View Post
AFAIK there is no native / event for knowing when a player is viewing or has closed an MOTD screen. Would be useful though (or maybe there is and I just don't know about it).
That's not entirely accurate. You can find out when they close it.

If you manually create the motd with ShowVGUIPanel instead of ShowMOTDPanel, you can add the "cmd" key with a value for the command that you want the client to execute when it closes.

In some games (CS:S, TF2, DOD:S, HL2DM), this is an integer value, mapping to an enum of valid command, one being "closed_htmlpage". On other games, it's a string of whatever command you want (usually "closed_htmlpage" for consistency. You can then use AddCommandListener to watch for the command.

You can find the enum and an example in Dynamic MOTD
https://forums.alliedmods.net/showthread.php?p=1387386
or in the Pinion plugin
https://github.com/PinionTech/Pinion...ion_adverts.sp

As for knowing on the site when they're viewing it, you can check the user agent to see if they're from in-game.

Last edited by psychonic; 02-05-2013 at 07:28.
psychonic is offline
11530
Veteran Member
Join Date: Sep 2011
Location: Underworld
Old 02-05-2013 , 12:45   Re: Viewing Website in MOTD?
Reply With Quote #5

I wrote a method a while ago in the MOTD Backpack plugin which detects opening/closing too, if you want to give that a look at. Link's in my sig.
__________________
11530 is offline
SEGnosis
Senior Member
Join Date: Oct 2012
Old 02-05-2013 , 21:22   Re: Viewing Website in MOTD?
Reply With Quote #6

If you want to be a bit lazy, you could pass an argument through the url such as ?ingame=true. Then check for that and possibly save it as a cookie for when they lurk around your site some more.
__________________

SEGnosis is offline
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Old 02-06-2013 , 13:39   Re: Viewing Website in MOTD?
Reply With Quote #7

LOL
__________________
Sheepdude is offline
BoBzY
AlliedModders Donor
Join Date: Aug 2010
Location: Bruxelles
Old 02-06-2013 , 14:10   Re: Viewing Website in MOTD?
Reply With Quote #8

Quote:
Originally Posted by Sheepdude View Post
LOL
???
BoBzY is offline
Sheepdude
SourceMod Donor
Join Date: Aug 2012
Location: Chicago
Old 02-06-2013 , 14:44   Re: Viewing Website in MOTD?
Reply With Quote #9

1. Your kitty face

2. Your code

3. Awww
__________________
Sheepdude is offline
BoBzY
AlliedModders Donor
Join Date: Aug 2010
Location: Bruxelles
Old 02-06-2013 , 15:29   Re: Viewing Website in MOTD?
Reply With Quote #10

Quote:
Originally Posted by Sheepdude View Post
1. Your kitty face

2. Your code

3. Awww

Its kinda what he's looking for.

I see
BoBzY 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 13:53.


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