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

CSGO MOTD new redirect method (2017)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
root88
Senior Member
Join Date: May 2016
Old 08-14-2017 , 12:14   CSGO MOTD new redirect method (2017)
Reply With Quote #1

Hi there. I've seen few bad plugins without sharing full code (I mean php code):
WebLinks - https://forums.alliedmods.net/showthread.php?t=300313
WebLync - https://forums.alliedmods.net/showthread.php?t=298458

Isn't it against alliedmodders forum rules? Well, as moderators are doing nothing about that, I've spent some time testing possible solutions (idk if it's the same method used in above plugins - but probably it is).

So, you will need some php code, example below (redirect.php)
PHP Code:
<?php
if(isset($_GET['url']))
{
    
$url =  $_GET['url'];
}
else
{
    die(
'No redirection url set!');
}
header("Content-Encoding: none");
ob_end_clean();
ignore_user_abort(true);
ob_start();
echo 
"<script type=\"text/javascript\">
window.open('
$url', 'www', false);
</script>
"
;
$size ob_get_length();
header("Content-Length: $size");
header("Connection: close");
ob_end_flush();
ob_flush();
flush();
exit();
?>
Example SourcePawn plugin below (webshortcuts_test.sp)
PHP Code:
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0.0"

public Plugin:myinfo =
{
    
name "CS: GO Webshortcuts",
    
author "root",
    
description "Just simple webshortcuts.",
    
version PLUGIN_VERSION,
    
url "http://uwujka.pl"
}

char sRedirectPHP[] = "http://ADDRESS_TO_YOUR_WEB_PAGE/redirect.php?url=";
char sUrl2[MAXPLAYERS+1][256];

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_www"www);
    
RegConsoleCmd("sm_sail"sail);
}

public 
Action:www(clientargs)
{
    
char sUrl[] = "http://uwujka.pl";
    
Format(sUrl2[client], 256"%s%s"sRedirectPHPsUrl);
    
ShowMOTDPanel(client""sUrlMOTDPANEL_TYPE_URL);
    
CreateTimer(0.5ShowReloadedUrlclient);
    return 
Plugin_Handled;
}

public 
Action:sail(clientargs)
{
    
char sUrl[] = "https://www.youtube.com/watch?v=YS4fXhiVEQM";
    
Format(sUrl2[client], 256"%s%s"sRedirectPHPsUrl);
    
ShowMOTDPanel(client""sUrlMOTDPANEL_TYPE_URL);
    
CreateTimer(0.5ShowReloadedUrlclient);
    return 
Plugin_Handled;
}

public 
Action:ShowReloadedUrl(Handle:timerany:client)
{
    
ShowMOTDPanel(client""sUrl2[client], MOTDPANEL_TYPE_URL);


You can easily adapt code to any web shortcuts plugin. Have fun, but please - give me credits if you use my code. I've made many plugins which I'm not sharing with you because many people just took my code and gave credits to themselves (sadly most of them are from Poland).

WARNING: IT WILL NOT WORK IF YOUR WEB SERVER USES SERVICE LIKE CLOUDFLARE WHICH MODIFICATES HEADERS!

EDIT:
It seems it's not reloading this page now for unknown reason - showing the same page, no mather if I change url. I will look at this...


EDIT2:
Fixed above bug with new plugin code.
__________________

Last edited by root88; 08-14-2017 at 13:23. Reason: Fixed bug with page not reloading
root88 is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 08-14-2017 , 14:45   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #2

Sharing is caring! <3
Ejziponken is offline
Ejziponken
AlliedModders Donor
Join Date: Apr 2008
Old 08-14-2017 , 14:50   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #3

Quote:
Originally Posted by root88 View Post
Hi there. I've seen few bad plugins without sharing full code (I mean php code):
WebLinks - https://forums.alliedmods.net/showthread.php?t=300313
WebLync - https://forums.alliedmods.net/showthread.php?t=298458

Isn't it against alliedmodders forum rules? Well, as moderators are doing nothing about that, I've spent some time testing possible solutions (idk if it's the same method used in above plugins - but probably it is).

So, you will need some php code, example below (redirect.php)
PHP Code:
<?php
if(isset($_GET['url']))
{
    
$url =  $_GET['url'];
}
else
{
    die(
'No redirection url set!');
}
header("Content-Encoding: none");
ob_end_clean();
ignore_user_abort(true);
ob_start();
echo 
"<script type=\"text/javascript\">
window.open('
$url', 'www', false);
</script>
"
;
$size ob_get_length();
header("Content-Length: $size");
header("Connection: close");
ob_end_flush();
ob_flush();
flush();
exit();
?>
Example SourcePawn plugin below (webshortcuts_test.sp)
PHP Code:
#include <sourcemod>
#pragma semicolon 1
#define PLUGIN_VERSION "1.0.0"

public Plugin:myinfo =
{
    
name "CS: GO Webshortcuts",
    
author "root",
    
description "Just simple webshortcuts.",
    
version PLUGIN_VERSION,
    
url "http://uwujka.pl"
}

char sRedirectPHP[] = "http://ADDRESS_TO_YOUR_WEB_PAGE/redirect.php?url=";
char sUrl2[MAXPLAYERS+1][256];

public 
OnPluginStart()
{
    
RegConsoleCmd("sm_www"www);
    
RegConsoleCmd("sm_sail"sail);
}

public 
Action:www(clientargs)
{
    
char sUrl[] = "http://uwujka.pl";
    
Format(sUrl2[client], 256"%s%s"sRedirectPHPsUrl);
    
ShowMOTDPanel(client""sUrlMOTDPANEL_TYPE_URL);
    
CreateTimer(0.5ShowReloadedUrlclient);
    return 
Plugin_Handled;
}

public 
Action:sail(clientargs)
{
    
char sUrl[] = "https://www.youtube.com/watch?v=YS4fXhiVEQM";
    
Format(sUrl2[client], 256"%s%s"sRedirectPHPsUrl);
    
ShowMOTDPanel(client""sUrlMOTDPANEL_TYPE_URL);
    
CreateTimer(0.5ShowReloadedUrlclient);
    return 
Plugin_Handled;
}

public 
Action:ShowReloadedUrl(Handle:timerany:client)
{
    
ShowMOTDPanel(client""sUrl2[client], MOTDPANEL_TYPE_URL);


You can easily adapt code to any web shortcuts plugin. Have fun, but please - give me credits if you use my code. I've made many plugins which I'm not sharing with you because many people just took my code and gave credits to themselves (sadly most of them are from Poland).

WARNING: IT WILL NOT WORK IF YOUR WEB SERVER USES SERVICE LIKE CLOUDFLARE WHICH MODIFICATES HEADERS!

EDIT:
It seems it's not reloading this page now for unknown reason - showing the same page, no mather if I change url. I will look at this...


EDIT2:
Fixed above bug with new plugin code.
Does not seem to work with my other webshortcuts_csgo plugin. Do I have to use youre plugin?

And ESKO who made WebLinks is saying he will release his webfiles. So not sure if you need to put any more effort into this.

But big thanks. <3

Last edited by Ejziponken; 08-14-2017 at 14:53.
Ejziponken is offline
root88
Senior Member
Join Date: May 2016
Old 08-14-2017 , 15:26   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #4

Yeah, you need to modify webshortcuts plugin too, or use my example webshortcuts.
__________________
root88 is offline
DarkDeviL
SourceMod Moderator
Join Date: Apr 2012
Old 08-14-2017 , 15:54   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #5

Quote:
Originally Posted by root88 View Post
Hi there. I've seen few bad plugins without sharing full code (I mean php code):
WebLinks - https://forums.alliedmods.net/showthread.php?t=300313
WebLync - https://forums.alliedmods.net/showthread.php?t=298458

Isn't it against alliedmodders forum rules? Well, as moderators are doing nothing about that, I've spent some time testing possible solutions (idk if it's the same method used in above plugins - but probably it is).
Latest public information is in this post, indicating that the web documents aren't a part of the GPL as required by the SourceMod license, and therefore, such "web API's" are not required to be released at all.

With a current position of having moderator / plugin approver abilities, I'm not acting (e.g. removing, un-approving, .. etc) such threads/plugins due to this.

If things are going to change, where AM won't officially support those kind of "half-released" plugins (without the html/.php's etc), as some appear to name them, I will of course act accordingly to any new kind of techniques / policies that may be introduced in the future.

But at the time of writing this, external things the plugin doesn't require to compile/run isn't required to be shared / GPL licensed either, as mentioned in the post linked above.
__________________
Mostly known as "DarkDeviL".

Dropbox FastDL: Public folder will no longer work after March 15, 2017!
For more info, see the [SRCDS Thread], or the [HLDS Thread].
DarkDeviL is offline
zipcore
Veteran Member
Join Date: Mar 2010
Location: m_flZipcore
Old 08-14-2017 , 16:51   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #6

Quote:
Originally Posted by root88 View Post
Isn't it against alliedmodders forum rules? Well, as moderators are doing nothing about that, I've spent some time testing possible solutions (idk if it's the same method used in above plugins - but probably it is).
Good job!
__________________
zipcore is offline
dubbeh
Senior Member
Join Date: Jul 2007
Old 08-14-2017 , 19:57   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #7

Here's a method to load hidden panels that's fully open source'd under the GPLv3 and a replacement to ShowMOTD panel - Can easily be extended for other types using the method above (Which i'll add sometime soon).

https://dubbeh.net/sourcemod-plugins/motd-fixer/

Main bit of code that I found to work with hidden panels is here - For anyone that's interested
__________________
SM Plugins - dubbeh.net - Plugin requests are welcome
dubbeh is offline
boomix
Senior Member
Join Date: May 2015
Location: Latvia
Old 08-14-2017 , 21:19   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #8

Just in few hours tried to make kinda good motd what it had missing

Mostly it is free proxy script, but edited for CS:GO MOTD. It's late soo I go sleep, but if anyone needs I can try to make code cleaner and add source tommorow of what I have changed, but for now I leave these links:
proxy source , cursors , scrollbar .

  • Fixed scrolling bar speed for all pages
  • Fixed scrolling bar color for all pages
  • Added url bar (could be also disabled or hidden)
  • Added home/reload button (could be also disable or hidden)
  • Fixed that target="_blank" is removed from all URL's making all the links clickable
  • Fixed cursor pointer for a href links


Here is result:

__________________

Last edited by boomix; 08-14-2017 at 21:24.
boomix is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 08-14-2017 , 22:31   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #9

I will update the csgo webshortcuts with the stuff here.

Also everyone are welcome to join in the repository of that plugin as collaborator for improve it freely (and add his credits if he want) instead of create more and more csgo webshortcuts plugin threads.
__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.


Last edited by Franc1sco; 08-14-2017 at 22:33.
Franc1sco is offline
Send a message via MSN to Franc1sco
Neuro Toxin
Veteran Member
Join Date: Oct 2013
Location: { closing the void; }
Old 08-14-2017 , 23:55   Re: CSGO MOTD new redirect method (2017)
Reply With Quote #10

I've made it clear how WebLync works.

Server sends url to api. Client redirects from api to page set by server.

There is no fancy javascript. I use the same old method.

I appreciate everyone trying to resolve the bug without a middle man api.

I dont appreciate the WebLinks author using the same name as pronounced WebLync.
__________________

Last edited by Neuro Toxin; 08-15-2017 at 00:04.
Neuro Toxin is offline
Reply


Thread Tools
Display Modes

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 16:22.


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