View Full Version : [TF2] How to block Cheat Commands
Hi,
I have a plugin which requires the sv_cheats cvar to be 1 to work properly. I am wondering if anyone knows how to block cheat commands such as noclip, god, buddha, etc.
I have tried the same methods as the Cheat Control plugin uses, but unfortunately this doesn't block said cheat commands.
Thanks!
Steveh
turtsmcgurts
12-30-2011, 12:50
I'm not completely positive, but you should be able to hook each command with RegConsoleCmd (http://docs.sourcemod.net/api/index.php?fastload=show&id=470&) then put return Plugin_Handled; inside of it.
However, are you sure that you need to have sv_cheats enabled for your plugin? I know that you can adjust cheat values without actually turning cheats on.
I would look into option two because otherwise you would have a lot of commands to hook.
Hi,
I have tried the first method, that didn't work unfortunately.
The reason the server needs cheats on is because in TF2, the change in host_timescale doesn't take effect on clients.
Otherwise, if cheats are off and the host_timescale is changed on the server, the value is replicated to the clients, but doesn't work the same as if cheats were on.
Steveh
turtsmcgurts
12-31-2011, 20:20
Hi,
I have tried the first method, that didn't work unfortunately.
The reason the server needs cheats on is because in TF2, the change in host_timescale doesn't take effect on clients.
Otherwise, if cheats are off and the host_timescale is changed on the server, the value is replicated to the clients, but doesn't work the same as if cheats were on.
Steveh
I know i'm kind of going around what you're asking for, but I believe it would be more efficient.
What exactly are you trying to get out of host_timescale? If you're trying to change client speed
SetEntDataFloat(client,FindSendPropInfo("CTFPlayer", "m_flMaxspeed"), newSpeed);
or, perhaps, you need it to decrease the game time quicker? I don't know of a way to change it besides editing the rcon command mp_timelimit.
Hopefully this helps; I would answer your question directly but I don't know how you would go about blocking the command : 3
Post thought: You could loop through the commands looking for FCVAR_CHEATS with "GetCommandFlags (http://docs.sourcemod.net/api/index.php?fastload=show&id=499&)". However, after a little research (https://forums.alliedmods.net/showpost.php?p=626417&postcount=2), I found...
Hook the command and "return Plugin_Handled;". Some things can not be blocked though as they happen client side as well.
Dr. McKay
12-31-2011, 20:42
This might possibly work, but I don't know.
SetConVarInt(FindConVar("host_timescale"), new_value);
for(new i = 0; i <= MAXPLAYERS; i++) {
SetFakeClientConVar(i, "host_timescale", new_value);
}
Hi,
I'm going to give changing the Player's speed a try, and the SetFakeClientConVar a try aswell.
I'll reply back soon with the results ^^
Hi,
I tried the SetFakeClientConVar, but that is only for Fake Clients (Bots). I will give changing the player speed a go. I also found Tickrate_Enabler Server Plugin, that changes the Tickrate of the server, and I thought maybe I would be able to change the host_timescale from there?
I'm not sure, but I'll post my findings here.
Cheers
Mecha the Slag
01-03-2012, 19:29
I tried the SetFakeClientConVar, but that is only for Fake Clients (Bots)
No it's not
It sends a value to the specific client, making the client think said convar is the specific value; when it's not really.
Dr. McKay
01-03-2012, 20:38
No it's not
It sends a value to the specific client, making the client think said convar is the specific value; when it's not really.
No, he's correct. I gave him the wrong function. The one you want is SendConVarValue.
vBulletin® v3.8.7, Copyright ©2000-2024, vBulletin Solutions, Inc.