AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   Viewing Website in MOTD? (https://forums.alliedmods.net/showthread.php?t=207647)

Snaggle 02-05-2013 04:20

Viewing Website in MOTD?
 
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.

PriceLess 02-05-2013 04:42

Re: Viewing Website in MOTD?
 
Good question.

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

Sheepdude 02-05-2013 06:41

Re: Viewing Website in MOTD?
 
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).

psychonic 02-05-2013 07:27

Re: Viewing Website in MOTD?
 
Quote:

Originally Posted by Sheepdude (Post 1887446)
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.

11530 02-05-2013 12:45

Re: Viewing Website in MOTD?
 
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.

SEGnosis 02-05-2013 21:22

Re: Viewing Website in MOTD?
 
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.

Sheepdude 02-06-2013 13:39

Re: Viewing Website in MOTD?
 
LOL

BoBzY 02-06-2013 14:10

Re: Viewing Website in MOTD?
 
Quote:

Originally Posted by Sheepdude (Post 1888558)
LOL

???

Sheepdude 02-06-2013 14:44

Re: Viewing Website in MOTD?
 
1. Your kitty face

2. Your code

3. Awww

BoBzY 02-06-2013 15:29

Re: Viewing Website in MOTD?
 
Quote:

Originally Posted by Sheepdude (Post 1888595)
1. Your kitty face

2. Your code

3. Awww


Its kinda what he's looking for.

I see


All times are GMT -4. The time now is 02:47.

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