Raised This Month: $9 Target: $400
 2% 

[TF2] How to block Cheat Commands


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Steveh
Member
Join Date: Oct 2010
Old 12-30-2011 , 10:57   [TF2] How to block Cheat Commands
Reply With Quote #1

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

Last edited by Steveh; 12-30-2011 at 10:58. Reason: Whoops, spelling mistake ^.^
Steveh is offline
turtsmcgurts
SourceMod Donor
Join Date: Jul 2011
Old 12-30-2011 , 13:50   Re: [TF2] How to block Cheat Commands
Reply With Quote #2

I'm not completely positive, but you should be able to hook each command with RegConsoleCmd 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.
turtsmcgurts is offline
Steveh
Member
Join Date: Oct 2010
Old 12-31-2011 , 20:45   Re: [TF2] How to block Cheat Commands
Reply With Quote #3

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
Steveh is offline
turtsmcgurts
SourceMod Donor
Join Date: Jul 2011
Old 12-31-2011 , 21:20   Re: [TF2] How to block Cheat Commands
Reply With Quote #4

Quote:
Originally Posted by Steveh View Post
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
Code:
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". However, after a little research, I found...
Quote:
Originally Posted by bl4nk View Post
Hook the command and "return Plugin_Handled;". Some things can not be blocked though as they happen client side as well.
turtsmcgurts is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 12-31-2011 , 21:42   Re: [TF2] How to block Cheat Commands
Reply With Quote #5

This might possibly work, but I don't know.

PHP Code:
SetConVarInt(FindConVar("host_timescale"), new_value);
for(new 
0<= MAXPLAYERSi++) {
    
SetFakeClientConVar(i"host_timescale"new_value);

__________________
Dr. McKay is offline
Steveh
Member
Join Date: Oct 2010
Old 01-01-2012 , 13:25   Re: [TF2] How to block Cheat Commands
Reply With Quote #6

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 ^^
Steveh is offline
Steveh
Member
Join Date: Oct 2010
Old 01-03-2012 , 05:36   Re: [TF2] How to block Cheat Commands
Reply With Quote #7

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
Steveh is offline
Mecha the Slag
Veteran Member
Join Date: Jun 2009
Location: Denmark
Old 01-03-2012 , 20:29   Re: [TF2] How to block Cheat Commands
Reply With Quote #8

Quote:
Originally Posted by Steveh View Post
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.
__________________
Mecha the Slag is offline
Dr. McKay
Sir Dr. SourceMod Plugin Approver Esq. Ltd. M.D. PhD
Join Date: Aug 2011
Location: Atlantis
Old 01-03-2012 , 21:38   Re: [TF2] How to block Cheat Commands
Reply With Quote #9

Quote:
Originally Posted by Mecha the Slag View Post
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.
__________________
Dr. McKay 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 10:51.


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