AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Block Any Command in Console (https://forums.alliedmods.net/showthread.php?t=76019)

Kitami 08-16-2008 22:59

Block Any Command in Console
 
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
    



ot_207 08-17-2008 02:05

Re: Block Any Command in Console
 
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.

ConnorMcLeod 08-17-2008 03:15

Re: Block Any Command in Console
 
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).

Kitami 08-18-2008 03:32

Re: Block Any Command in Console
 
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.

danielkza 08-18-2008 14:13

Re: Block Any Command in Console
 
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.

Kitami 08-18-2008 15:44

Re: Block Any Command in Console
 
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


All times are GMT -4. The time now is 03:16.

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