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

Solved [Help] sm_cvar host_timescale not working


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
axelnieves2012
Senior Member
Join Date: Oct 2014
Location: Argentina
Old 09-19-2020 , 00:59   [Help] sm_cvar host_timescale not working
Reply With Quote #1

Left 4 Dead 1

Hello, I would like to set host_timescale to "1.1" on my server.
Everything seems to be ok, host_timescale changes its value but nothing changes really.
I need to turn sv_cheats on to make it work.

Is any way to set host_timescale and make it work without enabling sv_cheats??
Thanks

Last edited by axelnieves2012; 01-24-2021 at 17:06.
axelnieves2012 is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-19-2020 , 05:04   Re: [Help] sm_cvar host_timescale not working
Reply With Quote #2

...I guess, from client side, it check sv_cheats status before change client own time scale

Maybe better send request to Valve team, to give us bullet time (or new host_timescale option).
Bacardi is offline
Johnoclock
Member
Join Date: Oct 2014
Location: denmark
Old 12-04-2020 , 19:47   Re: [Help] sm_cvar host_timescale not working
Reply With Quote #3

try using https://sm.alliedmods.net/new-api/co...SetConVarFloat

here a example
Quote:
SetConVarFloat(host_timescale, 1.0);
Johnoclock is offline
cravenge
Veteran Member
Join Date: Nov 2015
Location: Chocolate Factory
Old 12-05-2020 , 00:00   Re: [Help] sm_cvar host_timescale not working
Reply With Quote #4

This is what you're looking for.
cravenge is offline
axelnieves2012
Senior Member
Join Date: Oct 2014
Location: Argentina
Old 01-24-2021 , 16:30   Re: [Help] sm_cvar host_timescale not working
Reply With Quote #5

Quote:
Originally Posted by cravenge View Post
This is what you're looking for.
Hi, thanks for answering. I tested and it didn't work.

I installed that plugns+gamedata,
restarted my server,
sm_cvar host_timescale 2.0
And nothing worked

After that, I made a testing plugin:
PHP Code:
public void OnPluginStart()
{
    
SetConVarFloat(FindConVar("host_timescale"), 2.0);

And nothing worked.

Do you know what am I doing wrong?
axelnieves2012 is offline
axelnieves2012
Senior Member
Join Date: Oct 2014
Location: Argentina
Old 01-24-2021 , 16:59   Re: [Help] sm_cvar host_timescale not working
Reply With Quote #6

SOLVED. I had to make an extra plugin but it works now.
Here is the source if anyone needs it.
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: sp Get Plugin or Get Source (host_timescale.sp - 111 views - 1.2 KB)
File Type: smx host_timescale.smx (3.1 KB, 59 views)

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 04:14.


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