AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How to block some commands on a Specific map? (https://forums.alliedmods.net/showthread.php?t=180275)

bibu 03-14-2012 14:42

Re: How to block some commands on a Specific map?
 
Quote:

Originally Posted by Xvil (Post 1668887)
Test This:
[PHP]...

http://cdn.electricpig.com.s3-extern...oh-god-why.jpg

kramesa 03-14-2012 14:50

Re: How to block some commands on a Specific map?
 
Quote:

Originally Posted by bibu (Post 1668908)


Exolent[jNr] 03-14-2012 14:55

Re: How to block some commands on a Specific map?
 
PHP Code:

#include <amxmodx>

public plugin_init() {
    
register_clcmd("say /pro15""block")
    
register_clcmd("say /top15""block")
    
register_clcmd("say /nub15""block")
}

public 
block(id)
{
    
client_print(idprint_chat"This command it's blocked.")
    return 
PLUGIN_HANDLED


Now just put that plugin in the proper plugins.ini for the maps you want it enabled.

bazhenov93 03-14-2012 16:28

Re: How to block some commands on a Specific map?
 
Quote:

Originally Posted by Exolent[jNr] (Post 1668915)
PHP Code:

#include <amxmodx>

public plugin_init() {
    
register_clcmd("say /pro15""block")
    
register_clcmd("say /top15""block")
    
register_clcmd("say /nub15""block")
}

public 
block(id)
{
    
client_print(idprint_chat"This command it's blocked.")
    return 
PLUGIN_HANDLED


Now just put that plugin in the proper plugins.ini for the maps you want it enabled.

still not working :S

maybe i need delete this commands in kreedz plugin and compile it with another name and enable it only for longjumps maps

bazhenov93 03-14-2012 16:31

Re: How to block some commands on a Specific map?
 
BUT would be nice if

Quote:

new const rmaps[][] =
{
"kz_longjumps2",
"kzlt_weridjumps"
}
by killergirl

but i tried and not working :(

Xvil 03-14-2012 17:13

Re: How to block some commands on a Specific map?
 
Quote:

Originally Posted by Xvil (Post 1668887)
Test This:
PHP Code:

#include <amxmodx>
#include <amxmisc>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "Xvil"

public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
register_clcmd("say /pro15""block")
    
register_clcmd("say /top15""blcok")
    
register_clcmd("say /nub15""block")
}

public 
block(id)
{
    static 
Map[50]
    
    
get_mapname(Mapcharsmax(Map))
    
    if(
equal(Map,"kzlt_weridjumps") || equal(Map,"kz_longjumps2") )
    {
      
client_print(idprint_chat"This command it's blocked.")
      return 
PLUGIN_HANDLED
    
}
    return 
PLUGIN_CONTINUE



Test this i'm shure that will work

bazhenov93 03-14-2012 17:22

Re: How to block some commands on a Specific map?
 
Quote:

Originally Posted by Xvil (Post 1669003)
Test this i'm shure that will work

Error: Undefined symbol "map" on line 20

Exolent[jNr] 03-14-2012 17:35

Re: How to block some commands on a Specific map?
 
Quote:

Originally Posted by Xvil (Post 1669003)
Test this i'm shure that will work

It's also poorly coded.

Devil259 03-15-2012 06:54

Re: How to block some commands on a Specific map?
 
The first solution is the solution given by Exolent :
- Create a "maps" folder in ./configs/.
- Put the plugin which block the command in plugins-mapname.ini (replace mapname by map's name).
- Put plugins-mapname.ini in ./configs/maps/

The second solution is this one :

Code:
#include < amxmodx > new const g_szMaps[ ][ ] = {     "kz_longjumps2",     "kzlt_weridjumps" } public plugin_init() {     new szMapName[ 32 ];     for( new i = 0; i < sizeof( g_szMaps ); i++ )     {         get_mapname( szMapName, 31 );         if( equal( szMapName, g_szMaps[ i ] ) )         {             register_clcmd( "say /pro15", "block" );             register_clcmd( "say /top15", "block" );             register_clcmd( "say /nub15", "block" );         }     } } public block( id ) {     client_print( id, print_chat, "This command it's blocked." )     return PLUGIN_HANDLED; }

and put this plugin above kz plugin.

As far as I know, the first solution is better.

Exolent[jNr] 03-15-2012 09:39

Re: How to block some commands on a Specific map?
 
Devil almost had it right.

Code:
#include < amxmodx > new const g_szMaps[ ][ ] = {     "kz_longjumps2",     "kzlt_weridjumps" } public plugin_init() {     new szMapName[ 32 ];
    get_mapname( szMapName, 31 ); // moved out of loop
        for( new i = 0; i < sizeof( g_szMaps ); i++ )     {         if( equal( szMapName, g_szMaps[ i ] ) )         {             register_clcmd( "say /pro15", "block" );             register_clcmd( "say /top15", "block" );             register_clcmd( "say /nub15", "block" );            
            break; // no need to check other maps if we found a match
        }     } } public block( id ) {     client_print( id, print_chat, "This command it's blocked." )     return PLUGIN_HANDLED; }

A plugin checking the map is actually the only solution because it has to be put at the top of the plugins.ini.
You can't set it at the top with per-map plugins.ini files.


All times are GMT -4. The time now is 07:57.

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