Raised This Month: $32 Target: $400
 8% 

[CSGO] HexRedirect - Workaround for MOTDs


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Plugin ID:
6366
Plugin Version:
1.21
Plugin Category:
Server Management
Plugin Game:
Counter-Strike: GO
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    A workaround for MOTDs in CSGO
    Old 12-13-2018 , 15:08   [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #1




    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!
    __________________
    My Plugins
    SPCode


    Steam: hexer504
    Telegram: Hexah
    Discord: Hexah#6903

    If you like my work you can donate here!

    Last edited by Papero; 12-25-2018 at 16:42. Reason: Plugin update
    Papero is offline
    Aes
    Junior Member
    Join Date: Nov 2018
    Old 12-13-2018 , 17:50   Re: [CSGO] HexRedirect
    Reply With Quote #2

    Gonna try asap!
    Aes is offline
    hoycieto
    Senior Member
    Join Date: Feb 2018
    Old 12-14-2018 , 05:07   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #3

    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

    Last edited by hoycieto; 12-14-2018 at 06:05. Reason: Added SM version
    hoycieto is offline
    freak.exe_uLow
    AlliedModders Donor
    Join Date: Jul 2012
    Location: Germany
    Old 12-14-2018 , 06:39   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #4

    Well done, thanks for sharing

    Last edited by freak.exe_uLow; 12-14-2018 at 06:39.
    freak.exe_uLow is offline
    Papero
    Veteran Member
    Join Date: Aug 2016
    Location: Italy
    Old 12-14-2018 , 06:46   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #5

    Quote:
    Originally Posted by hoycieto View Post
    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.
    __________________
    My Plugins
    SPCode


    Steam: hexer504
    Telegram: Hexah
    Discord: Hexah#6903

    If you like my work you can donate here!
    Papero is offline
    hoycieto
    Senior Member
    Join Date: Feb 2018
    Old 12-14-2018 , 06:50   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #6

    Quote:
    Originally Posted by Papero View Post
    I think I got where the error is, goona fix as soon as I'm home.
    Okay, thanks for your work
    hoycieto is offline
    Papero
    Veteran Member
    Join Date: Aug 2016
    Location: Italy
    Old 12-14-2018 , 09:43   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #7

    Ok It should be fixed, get the latest version here: https://github.com/Hexer10/HexRedirect/releases
    __________________
    My Plugins
    SPCode


    Steam: hexer504
    Telegram: Hexah
    Discord: Hexah#6903

    If you like my work you can donate here!
    Papero is offline
    hoycieto
    Senior Member
    Join Date: Feb 2018
    Old 12-14-2018 , 10:37   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #8

    Yep, plugin works, I'm getting data to database but... "Server website" button doesn't appears :/
    hoycieto is offline
    kgns
    Senior Member
    Join Date: May 2017
    Location: Istanbul, Turkey
    Old 12-14-2018 , 11:29   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #9

    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
    __________________

    OyunHost Sunucu Hizmetleri: https://www.oyunhost.net
    kgns is offline
    Papero
    Veteran Member
    Join Date: Aug 2016
    Location: Italy
    Old 12-14-2018 , 15:49   Re: [CSGO] HexRedirect - Workaround for MOTDs
    Reply With Quote #10

    Quote:
    Originally Posted by kgns View Post
    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.
    __________________
    My Plugins
    SPCode


    Steam: hexer504
    Telegram: Hexah
    Discord: Hexah#6903

    If you like my work you can donate here!
    Papero 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 00:36.


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