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

[ANY?] Timescale Windows Fix


Post New Thread Reply   
 
Thread Tools Display Modes
Author
bakugo
Member
Join Date: Nov 2012
Plugin ID:
7097
Plugin Version:
1.0.0
Plugin Category:
General Purpose
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    18 
    Plugin Description:
    Fixes host_timescale without sv_cheats on Windows servers
    Old 05-10-2020 , 19:09   [ANY?] Timescale Windows Fix
    Reply With Quote #1

    This plugin allows host_timescale changes to work on Windows servers without having to turn on sv_cheats. This has always worked fine on Linux servers, but there is some extra engine code that only exists on Windows for some reason that prevents the value from being applied if cheats are disabled.

    Keep in mind that you will still need to set a fake sv_cheats 1 value on the client using SendConVarValue for timescale to work without desync issues. This will not allow the client to use server-side cheat commands like noclip, but they will be able to use clientside cheats such as mat_wireframe. These clientside cheats will automatically disable themselves if you set the fake sv_cheats value back to 0.

    An example of an existing plugin that benefits from this fix is Freak Fortress 2. Ninja Spy's slowmo rage normally does not work properly on Windows servers, but with this, it will.

    This has only been tested in TF2, but in theory it should work for other games with the same/similar engine.


    Installation
    • Put timescale_win_fix.smx in the plugins folder
    • Put timescale_win_fix.txt in the gamedata folder
    Attached Files
    File Type: sp Get Plugin or Get Source (timescale_win_fix.sp - 910 views - 1.2 KB)
    File Type: smx timescale_win_fix.smx (3.0 KB, 545 views)
    File Type: txt timescale_win_fix.txt (274 Bytes, 673 views)

    Last edited by bakugo; 05-10-2020 at 19:28.
    bakugo is offline
    XGAK
    Junior Member
    Join Date: May 2018
    Old 05-14-2020 , 04:19   Re: [ANY?] Timescale Windows Fix
    Reply With Quote #2

    Nice work. Thanks for the fix!

    Last edited by XGAK; 05-14-2020 at 04:23.
    XGAK is offline
    axelnieves2012
    Senior Member
    Join Date: Oct 2014
    Location: Argentina
    Old 01-24-2021 , 16:32   Re: [ANY?] Timescale Windows Fix
    Reply With Quote #3

    Seem not working on L4D1.

    Where are the instructions??
    I installed your plugin+gamedata,
    restarted my server,
    sm_cvar host_timescale 2.0

    And nothing happened.
    (Windows 10, L4D1 Dedicated Server)

    Last edited by axelnieves2012; 01-24-2021 at 16:33.
    axelnieves2012 is offline
    axelnieves2012
    Senior Member
    Join Date: Oct 2014
    Location: Argentina
    Old 01-24-2021 , 17:00   Re: [ANY?] Timescale Windows Fix
    Reply With Quote #4

    SOLVED. I had to make an extra plugin but it works now.
    Here is the source if anyone needs it.
    Works pretty fine on L4D1 now.
    Nice work.
    Maybe I would have to check if client disables sv_cheats on his console.
    I wonder whats happens if one client overrides "sv_cheats 1" while other clients are in "slow camera" (host_timescale 0.5).

    PHP Code:
    #include <sourcemod>
    #pragma semicolon 1
    #pragma newdecls required

    #define PLUGIN_VERSION "1.0"

    public Plugin myinfo =
    {
        
    name "Host Time Scale",
        
    author "Axel Juan Nieves",
        
    description "",
        
    version PLUGIN_VERSION,
        
    url ""
    };

    ConVar host_timescalesv_cheats;

    public 
    void OnPluginStart()
    {
        
    host_timescale FindConVar("host_timescale");
        
    sv_cheats FindConVar("sv_cheats");
        
    HookConVarChange(host_timescaleTimescaleChange);
    }

    public 
    void OnClientPutInServer(int client)
    {
        if ( 
    IsFakeClient(client) )
            return;
        if ( 
    GetConVarFloat(host_timescale)!=1.0 )
            
    SendConVarValue(clientsv_cheats"1");
        else
            
    SendConVarValue(clientsv_cheats"0");
    }

    public 
    void OnClientDisconnect(int client)
    {
        if ( 
    IsFakeClient(client) )
            return;
        
    SendConVarValue(clientsv_cheats"0");
    }

    public 
    void TimescaleChange(Handle convar, const char[] oldValue, const char[] newValue)
    {
        for (
    int client=1client<=MaxClientsclient++)
        {
            if ( 
    IsFakeClient(client) )
                continue;
            if ( 
    GetConVarFloat(host_timescale)!=1.0 )
                
    SendConVarValue(clientsv_cheats"1");
            else
                
    SendConVarValue(clientsv_cheats"0");
        }

    Attached Files
    File Type: smx host_timescale.smx (3.1 KB, 173 views)
    File Type: sp Get Plugin or Get Source (host_timescale.sp - 294 views - 1.2 KB)

    Last edited by axelnieves2012; 01-24-2021 at 17:05.
    axelnieves2012 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 03:46.


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