Raised This Month: $ Target: $400
 0% 

Block Any Command in Console


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 08-16-2008 , 22:59   Block Any Command in Console
Reply With Quote #1

I was wondering if it would be possible to block clients that connect yo your server from using certain commands, for example on my server players can set_money if they know the command and a couple other things that shouldn't be used by clients or anyone.

I was planning to use this code and make it so that you can declare what commands u want block including cvars with a space.


PHP Code:
/* Script generated by Pawn Studio */

#include <amxmodx>
#include <amxmisc>
#include <fakemeta>
#include <colorchat>

#define PLUGIN    "Block Command"
#define AUTHOR    "Drogocop"
#define VERSION    "1.1"

#include "BlockCommand_inc\menu.inc"

new szPrefix[19] = "[BC]";        //Prefix or TAG for all client_chat mensagges

public plugin_init()
{
    
register_plugin(PLUGINVERSIONAUTHOR)

    
register_cvar("bc_blockbuy""1");                    // All buys Blocked
    
register_cvar("bc_blockradio""1");                // Block Radio commands
    
register_cvar("bc_blockchooseteam""1");            // Block Choose Team
    
register_clcmd("bc_blockchat""cmd_chatmute", -1"<name>"// Muted Chat of a player. 
    
register_clcmd("bc_blockchatmenu""menu_chatmute", -1"chat mute menu"// Open Chat Mute Menu
    
register_concmd("say""say_handle")
    
register_concmd("say_team""say_handle")
    
register_dictionary "blockcommand.txt" );
    
maxplayers get_maxplayers() + 1
    SayText 
get_user_msgid("SayText")
    
register_cvar("bc_prefix"szPrefix);
    
    
//Block  All Buy and Buy Binds
    
if (get_cvar_num("bc_blockbuy"))
    {
        
register_clcmd("buy""bblocked");
        
register_clcmd("cl_autobuy""bblocked");
        
register_clcmd("cl_rebuy""bblocked");
        
register_clcmd("cl_setautobuy""bblocked");
        
register_clcmd("cl_setrebuy""bblocked");
        
        
register_clcmd("glock""bblocked");
        
register_clcmd("usp""bblocked");
        
register_clcmd("p228""bblocked");
        
register_clcmd("deagle""bblocked");
        
register_clcmd("elites""bblocked");
        
register_clcmd("fn57""bblocked");
        
        
register_clcmd("mp5""bblocked");
        
register_clcmd("smg""bblocked");
        
register_clcmd("mac10""bblocked");
        
register_clcmd("tmp""bblocked");
        
register_clcmd("ump45""bblocked");
        
register_clcmd("p90""bblocked");
        
        
register_clcmd("m3""bblocked");
        
register_clcmd("xm1014""bblocked");
        
        
register_clcmd("famas""bblocked");
        
register_clcmd("m4a1""bblocked");
        
register_clcmd("ak47""bblocked");
        
register_clcmd("sg552""bblocked");
        
register_clcmd("galil""bblocked"); 
        
register_clcmd("aug""bblocked");
        
        
register_clcmd("scout""bblocked");
        
register_clcmd("awp""bblocked");
        
register_clcmd("sg550""bblocked");
        
register_clcmd("g3sg1""bblocked");
        
        
register_clcmd("m249""bblocked");
        
        
register_clcmd("hegren""bblocked");
        
register_clcmd("flash""bblocked");
        
register_clcmd("sgren""bblocked");
        
register_clcmd("vest""bblocked");
        
register_clcmd("vesthelm""bblocked");
        
register_clcmd("shield""bblocked");
        
register_clcmd("buyammo1""bblocked");
        
register_clcmd("buyammo1""bblocked");
        
register_clcmd("buyequip""bblocked");
    }
    
    
//Block Radio Commands
    
if (get_cvar_num("bc_blockradio"))
    {
        
register_clcmd("radio1""rblocked");
        
register_clcmd("radio2""rblocked");
        
register_clcmd("radio3""rblocked");
        
register_clcmd("coverme""rblocked")
        
register_clcmd("takepoint""rblocked")
        
register_clcmd("holdpos""rblocked")
        
register_clcmd("regroup""rblocked")
        
register_clcmd("followme""rblocked")
        
register_clcmd("takingfire""rblocked")
        
register_clcmd("go""rblocked")
        
register_clcmd("fallback""rblocked")
        
register_clcmd("sticktog""rblocked")
        
register_clcmd("getinpos""rblocked")
        
register_clcmd("stormfront""rblocked")
        
register_clcmd("report""rblocked")
        
register_clcmd("roger""rblocked")
        
register_clcmd("enemyspot""rblocked")
        
register_clcmd("needbackup""rblocked")
        
register_clcmd("sectorclear""rblocked")
        
register_clcmd("inposition""rblocked")
        
register_clcmd("reportingin""rblocked")
        
register_clcmd("getout""rblocked")
        
register_clcmd("negative""rblocked")
        
register_clcmd("enemydown""rblocked")
    }
    
    
//Block Choose Team
    
if (get_cvar_num("bc_blockchooseteam"))
    {
        
register_clcmd("chooseteam""ctblocked");
    }
    
    
//Block retry
    
if (get_cvar_num("bc_blockretry"))
    {
        
register_clcmd("retry""blockr");
    }
}

public 
bblocked(id)
    {
    
ColorChat(id,GREEN"%L"id"BLOCK_BUY"szPrefix);
    return 
PLUGIN_HANDLED
    
}
    
public 
rblocked(id)
    {
    
ColorChat(id,GREEN"%L"id"BLOCK_RADIO"szPrefix);
    return 
PLUGIN_HANDLED
    
}
    
public 
ctblocked(id)
    {
    
ColorChat(id,GREEN"%L"id"BLOCK_CHOOSETEAM"szPrefix);
    return 
PLUGIN_HANDLED
    

__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
ot_207
Veteran Member
Join Date: Jan 2008
Location: Romania The Love Country
Old 08-17-2008 , 02:05   Re: Block Any Command in Console
Reply With Quote #2

With the script that you made it is imposible to block client cvars, from what I know ...
The only way you can block(partially) their cvars, is to detect the value of them using -> clienct_query_cvar and if it doesn't correspond to server standarts kick/ban him or force the new value.
__________________
My approved plug-ins | Good for newbies! | Problems?

Back, will come around when I have time.

Last edited by ot_207; 08-17-2008 at 02:11.
ot_207 is offline
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 08-17-2008 , 03:15   Re: Block Any Command in Console
Reply With Quote #3

Also, you can't block client side commands such as 'connect', 'retry', 'reconnect' etc...
You can't block commands hooked by engine (such as 'status') because engine don't let those commands be sent to the dll (so metamod doesn't catch them, and same for amxx).
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 07-04-2012 at 00:54.
ConnorMcLeod is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 08-18-2008 , 03:32   Re: Block Any Command in Console
Reply With Quote #4

No nothing like that, I want to block client side commands to server plugins. Example if I type amx_help in console it will show nothing, but thats not the command I want to block.
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami is offline
danielkza
AMX Mod X Plugin Approver
Join Date: May 2007
Location: São Paulo - Brasil
Old 08-18-2008 , 14:13   Re: Block Any Command in Console
Reply With Quote #5

If you want to do this you're doing something very wrong on your plugins. You should not export functions using console commands if they're not meant to be used by players. Also, there are specfic plugins to block Radio Sounds, Weapon Buying, but you should not try to restrict every command. Also,as far as I know, it's not possible in AMXX.
danielkza is offline
Kitami
Senior Member
Join Date: Jun 2006
Location: Toronto
Old 08-18-2008 , 15:44   Re: Block Any Command in Console
Reply With Quote #6

Unfortunately I don't make all of my plugins so its hard to stop the plugins from doing so, well I dont see why it isnt possible, since these arnt client side commands there requesting information from the server, its like NSV
__________________
You know what I'd like to be? I mean if I had my goddamn choice, I'd just be the catcher in the rye and all.
Kitami 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 03:16.


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