AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Plugins (https://forums.alliedmods.net/forumdisplay.php?f=108)
-   -   [CSGO] HexRedirect - Workaround for MOTDs (https://forums.alliedmods.net/showthread.php?t=312720)

Papero 12-13-2018 15:08

[CSGO] HexRedirect - Workaround for MOTDs
 
https://img.shields.io/travis/Hexer1...le=flat-square https://img.shields.io/badge/License...le=flat-square https://img.shields.io/github/tag/He...le=flat-square https://img.shields.io/github/issues...le=flat-square


Installation:
Quote:

  1. Install the SteamWorks extention.
  2. Download there the latest plugin version.
  3. To install the sourcemod plugin just merge the addons/sourcemod located in GameServer/ folder with yours.
  4. Move the files inside the WebServer/ folder to your webserver.
  5. Edit the config.php file according to your needs.
  6. Set your motd.txt to redirect to the php script.
  7. Edit the auth token in both the config.php and the GameServer config cfg/plugin.HexRedirect.cfg

ConVars:
Quote:

  • sm_redirect_method -> Its value can be either steam or ip, and must match the one in the WebServer config
  • sm_redirect_website -> Full URL to your redirect.php
  • sm_redirect_authtoken -> Value of the auth string set in the WebServer config, required to make POST requests

Notes:
Quote:

  • The plugin configuration is located in sourcemod/configs/hexredirect.cfg
  • The patter is "command" "url"
  • Make sure to include the full url with the scheme as well(https or http).
  • The only cvar is that must match the PHP Script value. It can be either steam or ip
  • If you want to reload the config just use the sm_rredirect command!
  • The parameters are:
    Code:

    {STEAMID} -> Replaced with the player's steamid2 (eg. STEAM_1:0:138675850)
    {STEAMID64} -> Replaced with player's steamid64 (eg. 76561198237617428)
    {IP} -> Replaced with player's ip address (eg. 127.0.0.1)


Example configuration:
PHP Code:

"HexRedirect"
{
    
"google"    "https://www.google.com/"
    "!plugins" "https://forums.alliedmods.net/forumdisplay.php?f=123"
    "zombie" "steam://connect/127.0.0.1:27015" 
//Your server IP, this will make the player join there


To see the current TODOs and bugs or issue a new one check the ISSUES Page on github

Source Code


How this works:
Quote:

When a user types a command that is registered in the cfg his ip/steamid is sent as POST request to the webserver and it will set the url, whenver the user tryies to access the page it will check if his ip/steamid matches the one saved in the db, if so it will be redirected to the set url, otherwise it will be sent to the homepage.
When the user types that are listed in the cfg his ip/steamid is saved in the database, and when a user opens the motd page, it will check if the given IP/SteamID has any url to be redirected, if not it will just send to the set homepage.

Note that the PHP and the GameServer configurations must match, and if you the steam method is choose he will be required to login in, however his session his stored so he'll need to login once per session.

I know that is could not be the most reliable way (especially if two player have the same IP), but it's the only the I could figure without having the user to copy-paste the url.


Thanks to Caiine and kaganus who helped me with pool requests and bug reporting!

Aes 12-13-2018 17:50

Re: [CSGO] HexRedirect
 
Gonna try asap! :)

hoycieto 12-14-2018 05:07

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Hello, I'm getting this error:
Quote:

L 12/14/2018 - 11:06:09: SourceMod error session started
L 12/14/2018 - 11:06:09: Info (map "de_mirage") (file "errors_20181214.log")
L 12/14/2018 - 11:06:09: [HexRedirect.smx] Query failed: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'constraint redirects_token_uindex unique (token) )' at line 1 error
EDIT: SM version: 1.9-6267

freak.exe_uLow 12-14-2018 06:39

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Well done, thanks for sharing :bacon!:

Papero 12-14-2018 06:46

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Quote:

Originally Posted by hoycieto (Post 2628950)
Hello, I'm getting this error:


EDIT: SM version: 1.9-6267

I think I got where the error is, goona fix as soon as I'm home.

hoycieto 12-14-2018 06:50

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Quote:

Originally Posted by Papero (Post 2628964)
I think I got where the error is, goona fix as soon as I'm home.

Okay, thanks for your work :D

Papero 12-14-2018 09:43

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Ok It should be fixed, get the latest version here: https://github.com/Hexer10/HexRedirect/releases

hoycieto 12-14-2018 10:37

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Yep, plugin works, I'm getting data to database but... "Server website" button doesn't appears :/

kgns 12-14-2018 11:29

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
sent a pull request abstracting database operations from the plugin code. so you can use the same php url for multiple servers without exposing database credentials to those servers.
also allows direct timestamp comparison without the need to hassle with timezones
fixed a few small bugs

Papero 12-14-2018 15:49

Re: [CSGO] HexRedirect - Workaround for MOTDs
 
Quote:

Originally Posted by kgns (Post 2629007)
sent a pull request abstracting database operations from the plugin code. so you can use the same php url for multiple servers without exposing database credentials to those servers.
also allows direct timestamp comparison without the need to hassle with timezones
fixed a few small bugs

Thanks for the nice pr, I've just reviewed some parts after that I'll make sure to merge it.


All times are GMT -4. The time now is 09:01.

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