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

[CSGO] Fix - Block ping/status command plugin


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 08-16-2016 , 17:12   [CSGO] Fix - Block ping/status command plugin
Reply With Quote #1

Hey guys, over in this thread xeropw wrote up some code to block users (except admins) from being able to use the status or ping command to prevent flooding. Unfortunately, it blocks the 2 commands for all users, including admins. I was wondering if someone could fix this so admins are still able to use the commands.

The code in question:

PHP Code:
#include <sourcemod>
#pragma semicolon 1

/*
* This plugin will NOT stop your servers from getting crashed, however, it will prevent the
* status/ping cmd spam that causes extreme server instability that /may/ lead to or help spawn a crash.

* To edit the flag checked, scroll down to [Action:block] and replace ADMFLAG_GENERIC with your preferatus.
*
* CHANGELOG:
* 1.1:
* - Will ignore worldplayer(console) command blocking
* - Will ignore fakeplayer(bot) command blocking
*
* 1.0:
* - Initial Release
*/

public Plugin myinfo =
{
    
name "[DS] Status/Ping Restrictor",
    
author "xero, Maxximou5",
    
description "Restricts status/ping access to generic admins. Idea to block these commands by community member named v0id.",
    
version "1.1",
    
url "http://xero.pw"
};

public 
OnPluginStart()
{
    
RegConsoleCmd("status"block);
    
RegConsoleCmd("ping"block);
}

public 
Action block(clientargs)
{
    if(!(
client <= MaxClients) || !(GetUserFlagBits(client) & ADMFLAG_GENERIC)) return Plugin_Stop;
    
    
PrintToConsole(client"[DS] Admin+ detected, granting access to the requested command."); //optional just for minor debug to know that something preprocesses the blocked commands
    
return Plugin_Continue;


Last edited by sneaK; 08-16-2016 at 17:12.
sneaK is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 08-16-2016 , 18:24   Re: [CSGO] Fix - Block ping/status command plugin
Reply With Quote #2

Those commands don't get a valid client index for CS:GO (it's always 0), it was patched in the 2013 branch (CS:S, TF2, DoD:S, HL2:DM, 3rd party mods) for us by Valve, but CS:GO (and older games) doesn't have that fix.
__________________

Last edited by asherkin; 08-16-2016 at 18:25.
asherkin is offline
sneaK
SourceMod Moderator
Join Date: Feb 2015
Location: USA
Old 08-16-2016 , 18:36   Re: [CSGO] Fix - Block ping/status command plugin
Reply With Quote #3

Quote:
Originally Posted by asherkin View Post
Those commands don't get a valid client index for CS:GO (it's always 0), it was patched in the 2013 branch (CS:S, TF2, DoD:S, HL2M, 3rd party mods) for us by Valve, but CS:GO (and older games) doesn't have that fix.
Ah, so in theory this isn't possible to fix for admins at all.

I'm trying to think of an alternative way for my admins to be able to use a status command, but without giving rcon flag it seems like my options are limited. Perhaps block all status/ping requests using this plugin, and create a fake command that is flag protected that will utilize theY4Kman's Triggers plugin to send an rcon request to call status/ping?

Seems kind of hacky, but should work

Last edited by sneaK; 08-16-2016 at 18:36.
sneaK is offline
xeropw
AlliedModders Donor
Join Date: Jun 2016
Old 08-31-2016 , 19:14   Re: [CSGO] Fix - Block ping/status command plugin
Reply With Quote #4

I found a working solution with dhooks library.

Hook clientprintf.
Check if command string buffer contains any of the following:
Code:
Client ping times:
 ms : 
hostname: 
version : 
udp/ip  :
os      :  
type    :  
players : 

# userid name uniqueid connected ping loss state rate
#end
For individual client entries via status command, check for
# "" STEAM_ active
all in the same line. Set the param string as "" and return MRES_ChangedHandled.
Problem? You are replacing individual lines so you need a \n to ensure next command lands on a new line for a seamless "fix"... but, you could do \n for the #end buffer, but ping command does not have an explicit end.

------------

Alternative solution:
make your own status command such as admincmd pstatus which loops through all ingame&&connected&&!fakeplayer clients and parses them in a neat buffer with all the relevant information you want to have =)

I'll make a plugin for it in a few minutes.

Last edited by xeropw; 08-31-2016 at 19:20.
xeropw is offline
Sandervraun
Senior Member
Join Date: May 2019
Location: Denmark
Old 04-15-2020 , 13:45   Re: [CSGO] Fix - Block ping/status command plugin
Reply With Quote #5

Anyone found a solution to this?
Sandervraun 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 07:48.


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