Raised This Month: $ Target: $400
 0% 

(CSGO) Help with blocking "firstperson" console command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Sketchy
Senior Member
Join Date: Nov 2010
Old 01-19-2016 , 19:47   (CSGO) Help with blocking "firstperson" console command
Reply With Quote #1

One of the (CSGO) servers I run is a bHop server and one of the styles that players can use on the server is a "3'rd Person" viewpoint style. I was unaware of the following console commands thirdperson & firstperson. Turns out that thirdperson is marked as a cheat command but firstperson is obviously not. I need to block the firstperson console command so that players who are using the 3'rd Person bHop style, can't cheat and use that style while actually having a firstperson viewpoint.

I tried using this plugin here, but it doesn't seem to work.
Also tried the Command module of SMAC and it worked to block some test commands such as jointeam, it did NOT work to block firstperson command ;(

If anyone knows of a working plugin to block a console command, please post!

Last edited by Sketchy; 01-19-2016 at 20:38.
Sketchy is offline
statistician
Member
Join Date: Jan 2016
Location: Finland
Old 01-20-2016 , 02:53   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #2

I don't know about existing plugins for that specific request, but it would take you approx 15 minutes to do it yourself.

You could hook firstperson command and, well, block it. Try this:

Code:
public void OnPluginStart() {
    AddCommandListener(Cmd_Firstperson, "firstperson"); // hook a listener to the command
}

public Action Cmd_Firstperson(int client, const char[] cmd, int argc) {
    return Plugin_Handled;
}
Edit: well I went and did it myself I couldn't test it since I'm not at home, but it should work. It does nothing but blocks the firstperson-command.
Attached Files
File Type: sp Get Plugin or Get Source (fp.sp - 508 views - 431 Bytes)

Last edited by statistician; 01-20-2016 at 03:10. Reason: forgot to attach the source code
statistician is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 01-20-2016 , 04:50   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #3

Don't think you can block clientside commands that way, but maybe you can give it cheat flags
Miu is offline
Sketchy
Senior Member
Join Date: Nov 2010
Old 01-20-2016 , 04:53   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #4

Hrmm, for whatever reason the plugin doesn't work to block the firstperson command. Is there a way perhaps to mark it as a cheat so that it requires sv_cheats 1 just like the "thirdperson" command ?
Sketchy is offline
statistician
Member
Join Date: Jan 2016
Location: Finland
Old 01-20-2016 , 05:41   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #5

Like this?

Code:
SetCommandFlags("firstperson", GetCommandFlags("firstperson") | FCVAR_CHEAT);
statistician is offline
Godis
Senior Member
Join Date: Jan 2014
Old 01-20-2016 , 09:43   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #6

You cannot alter the flags of client-side convars.
Godis is offline
statistician
Member
Join Date: Jan 2016
Location: Finland
Old 01-20-2016 , 10:15   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #7

Well then, there's always this:

Code:
public void OnPluginStart() {
     AddCommandListener(Cmd_Firstperson, "firstperson"); // hook a listener to the command
}

public Action Cmd_Firstperson(int client, const char[] cmd, int argc) {
     CreateTimer(0.1, Timer_Thirdperson, client);
     return Plugin_Continue;
}

public Action Timer_Thirdperson(Handle timer, client) {
    
     // in case the client met his doom before the timer fired
     if (!IsClientConnected(client) || !IsPlayerAlive(client))
          return Plugin_Stop;

     ClientCommand(client, "thirdperson");
     return Plugin_Continue;
}
I think this won't work on clients unless they have cl_restrict_server_commands set to 0, though

Last edited by statistician; 01-20-2016 at 10:16.
statistician is offline
Miu
Veteran Member
Join Date: Nov 2013
Old 01-20-2016 , 12:54   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #8

Quote:
Originally Posted by statistician View Post
Like this?

Code:
SetCommandFlags("firstperson", GetCommandFlags("firstperson") | FCVAR_CHEAT);
Tried that on CSS earlier: It doesn't work, and it seems the server has no conception of the command existing at all since GetCommandFlags("firstperson") returns -1

Quote:
Originally Posted by statistician View Post
Well then, there's always this:

...
The reason you can't block client-side commands is because they're never sent to the server (the hook never actually fires), so that will not work either.

Quote:
Originally Posted by statistician View Post
I think this won't work on clients unless they have cl_restrict_server_commands set to 0, though
The third person modes usually put you in third person without you entering any commands at all, so either FakeClientCommand or ClientCommand ought to work by default. Maybe you can spam that to get them to stay in thirdperson, idk.
Miu is offline
Sketchy
Senior Member
Join Date: Nov 2010
Old 01-20-2016 , 16:12   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #9

Hrrmmmm... If we can't block the command itself, could we force anyone who types firstperson in the console to automatically type kill in the console, or join team spec? Or perhaps the act of typing firstperson could just be followed by force thirdperson right after so they just go straight back into thirdperson ?

Last edited by Sketchy; 01-20-2016 at 16:12.
Sketchy is offline
thecount
Veteran Member
Join Date: Jul 2013
Old 01-20-2016 , 16:22   Re: (CSGO) Help with blocking "firstperson" console command
Reply With Quote #10

PHP Code:
RegConsoleCmd("firstperson"OnFirstperson); 
?
thecount is offline
Reply



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 05:08.


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