View Single Post
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, 181 views)
File Type: sp Get Plugin or Get Source (host_timescale.sp - 298 views - 1.2 KB)

Last edited by axelnieves2012; 01-24-2021 at 17:05.
axelnieves2012 is offline