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)

bazhenov93 03-13-2012 08:23

How to block some commands on a Specific map?
 
On kz_longjumps2 // kzlt_weridjumps and longjumps maps, I want to block commans like " pro15 / top15 / nub15 " from kreedz plugin

BECAUSE i have an PLUGIN, that when you type this commands, will show another records...

IT's Possible? THANKS.

kiki33hun 03-13-2012 09:00

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

IT's Possible?
Yes

bazhenov93 03-13-2012 09:27

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

Originally Posted by kiki33hun (Post 1667998)
Yes

but " HOW "

Xvil 03-14-2012 08:23

Re: How to block some commands on a Specific map?
 
This an Example to block The Buy Commands command:

PHP Code:

new const gBuyCommands[ ][ ] =
{
        
"usp""glock""deagle""p228""elites",
        
"fn57""m3""xm1014""mp5""tmp""p90",
        
"mac10""ump45""ak47""galil""famas",
        
"sg552""m4a1""aug""scout""awp""g3sg1",
        
"sg550""m249""vest""vesthelm""flash",
        
"hegren""sgren""defuser""nvgs""shield",
        
"primammo""secammo""km45""9x19mm""nighthawk",
        
"228compact""fiveseven""12gauge""autoshotgun",
        
"mp""c90""cv47""defender""clarion""krieg552",
        
"bullpup""magnum""d3au1""krieg550"
        
"buy""buyammo1""buyammo2""buyequip""cl_autobuy",
        
"cl_rebuy""cl_setautobuy""cl_setrebuy"
}
public 
plugin_init() 

    
register_plugin("Block Buy Example""0.1.0""Xvil"

    for (new 
isizeof gBuyCommandsi++) 
        
register_clcmd(gBuyCommands[i], "BlockBuyCommands"


public 
BlockBuyCommands(id
{
    
// Block the buy commands. 
    
return PLUGIN_HANDLED



killergirl 03-14-2012 09:43

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

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

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

// add maps here for restriction
new const rmaps[][] =
{
    
"kz_longjumps2",
    
"kzlt_weridjumps"
}

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[32]
    
    
get_mapname(mapcharsmax(map))
    
    for(new 
0sizeof(rmaps) - 1i++){
        if(
equal(rmaps[i], map)){
            
client_print(idprint_chat"This command it's blocked.")
            break
        }
    }
    
    return 
PLUGIN_HANDLED


From here you need to implement the code from your plugins.

lucas_7_94 03-14-2012 09:48

Re: How to block some commands on a Specific map?
 
I think its better to make the loop in the plugin_init , and if map is equal to the list , set any boolean in true , or register the clcmds.

Devil259 03-14-2012 10:17

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

Originally Posted by lucas_7_94 (Post 1668734)
I think its better to make the loop in the plugin_init , and if map is equal to the list , set any boolean in true , or register the clcmds.

Right, because here, even if it is not "kz_longjumps2" or "kzlt_weridjumps" map, commands are blocked by "return PLUGIN_HANDLED".

bazhenov93 03-14-2012 11:04

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

Originally Posted by killergirl (Post 1668730)
PHP Code:

/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>

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

// add maps here for restriction
new const rmaps[][] =
{
    
"kz_longjumps2",
    
"kzlt_weridjumps"
}

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[32]
    
    
get_mapname(mapcharsmax(map))
    
    for(new 
0sizeof(rmaps) - 1i++){
        if(
equal(rmaps[i], map)){
            
client_print(idprint_chat"This command it's blocked.")
            break
        }
    }
    
    return 
PLUGIN_HANDLED


From here you need to implement the code from your plugins.

does not work. i also DISABLED prokreedz and still not working

fysiks 03-14-2012 13:56

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

Originally Posted by bazhenov93 (Post 1667987)
On kz_longjumps2 // kzlt_weridjumps and longjumps maps, I want to block commans like " pro15 / top15 / nub15 " from kreedz plugin

BECAUSE i have my own PLUGIN, that when you type this commands, will show another records...

It sounds to me like you would be better off editing the kreedz plugin that has those commands and doing this:


Quote:

Originally Posted by lucas_7_94 (Post 1668734)
I think its better to make the loop in the plugin_init , and if map is equal to the list , set any boolean in true , or register the clcmds.


Xvil 03-14-2012 14:04

Re: How to block some commands on a Specific map?
 
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



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.

bazhenov93 03-15-2012 10:09

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

Originally Posted by Exolent[jNr] (Post 1669316)
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.


Oh Yes finally it work. THANK YOU ALL!

bazhenov93 03-15-2012 10:20

Re: How to block some commands on a Specific map?
 
I also tried to add more commands to block, but i get 6 warnings when I compile

Quote:

#include <amxmodx>
#include <colorchat>

new const g_szMaps[ ][ ] =
{
"kz_longjumps2",
"kzlt_weridjumps"
}

public plugin_init()
{
new szMapName[ 32 ];
get_mapname( szMapName, 31);

for( new i = 0; i < sizeof( g_szMaps ); i++ )
{
if( equal( szMapName, g_szMaps[ i ] ) )
{
register_clcmd( "say /pro15", "block" );
register_clcmd( "say /pro10", "block" );
register_clcmd( "say /pro", "block" );
register_clcmd( "say /top15", "block" );
register_clcmd( "say /top10", "block" );
register_clcmd( "say /top", "block" );
register_clcmd( "say /nub15", "block" );
register_clcmd( "say /nub10", "block" );
register_clcmd( "say /nub", "block" );



break;

}
}
}

public block( id )
{
ColorChat( id, GREY, "There is no Top for this map, type ^x01/records ^x03to see LongJumps WRs")
return PLUGIN_HANDLED;
}


Warning: Loose indentation on line 20
Warning: Loose indentation on line 22
Warning: Loose indentation on line 23
Warning: Loose indentation on line 25
Warning: Loose indentation on line 26
Warning: Loose indentation on line 31


but still working.. just want to know why i get warns

killergirl 03-15-2012 10:42

Re: How to block some commands on a Specific map?
 
Simple warnings, you can ignore them.

Devil259 03-15-2012 12:24

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

Originally Posted by Exolent[jNr] (Post 1669316)
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.

Oh yes, forgot to move get_mapname out of loop, my bad.

Xvil 03-15-2012 13:52

Re: How to block some commands on a Specific map?
 
I'm Sorry A little error
It Work Now

Code:
#include <amxmodx> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Xvil" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /pro15", "block")     register_clcmd("say /top15", "blcok")     register_clcmd("say /nub15", "block") } public block(id) {     static Map[50]    
    get_mapname(Map, charsmax(Map))
        if(equal(Map,"kzlt_weridjumps") || equal(Map,"kz_longjumps2") )     {       client_print(id, print_chat, "This command it's blocked.")       return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

.Dare Devil. 03-15-2012 13:59

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

Originally Posted by Xvil (Post 1669446)
I'm Sorry A little error
It Work Now

Code:
#include <amxmodx> #define PLUGIN "New Plug-In" #define VERSION "1.0" #define AUTHOR "Xvil" public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)         register_clcmd("say /pro15", "block")     register_clcmd("say /top15", "blcok")     register_clcmd("say /nub15", "block") } public block(id) {     static Map[50]    
    get_mapname(Map, charsmax(Map))
        if(equal(Map,"kzlt_weridjumps") || equal(Map,"kz_longjumps2") )     {       client_print(id, print_chat, "This command it's blocked.")       return PLUGIN_HANDLED     }     return PLUGIN_CONTINUE }

Quote:

Originally Posted by bibu (Post 1668908)


killergirl 03-15-2012 14:05

Re: How to block some commands on a Specific map?
 
http://static.fjcdn.com/comments/Don...ca271b22e3.jpg

Xvil 03-15-2012 14:13

Re: How to block some commands on a Specific map?
 
http://static.fjcdn.com/pictures/pap...be_3455232.jpg

Exolent[jNr] 03-15-2012 14:19

Re: How to block some commands on a Specific map?
 
Xvil, your code is a bad method of going about this type of plugin.
That is why people are saying "Oh god, why" to your code.
What I posted (the edit of Devil's code) is the best method in the thread.

.Dare Devil. 03-15-2012 14:25

Re: How to block some commands on a Specific map?
 
Anyway Xvil, its good that you try to help someone but when someone veteran member post the code what looks so great, then i think update/write your code is too useless. :)
No hard Feelings..

Xvil 03-15-2012 14:36

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

Originally Posted by .Dare Devil. (Post 1669464)
Anyway Xvil, its good that you try to help someone but when someone veteran member post the code what looks so great, then i think update/write your code is too useless. :)
No hard Feelings..

ok :cry:
but i like helping the others because I'm teaching and Learning in the same time

.Dare Devil. 03-15-2012 14:44

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

Originally Posted by Xvil (Post 1669474)
ok :cry:
but i like helping the others because I'm teaching and Learning in the same time

Same was me if i was new in here.
And also same things happen to me :):crab:

fysiks 03-15-2012 14:49

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

Originally Posted by Xvil (Post 1669474)
ok :cry:
but i like helping the others because I'm teaching and Learning in the same time

People who are still learning are much more likely to help incorrectly and that just causes frustration for the person requesting the code. Also, when helping people, it is wise to test your code before posting. However, that probably wouldn't have changed anything in this particular thread but it's some good advice for most cases.

Xvil 03-15-2012 14:55

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

Originally Posted by fysiks (Post 1669490)
People who are still learning are much more likely to help incorrectly and that just causes frustration for the person requesting the code. Also, when helping people, it is wise to test your code before posting. However, that probably wouldn't have changed anything in this particular thread but it's some good advice for most cases.

ok, thanks For you Advice :)

bazhenov93 03-28-2012 21:44

Re: How to block some commands on a Specific map?
 
Guys, I need help again......

the code is working, just fine, but you can type /menu and then choose top 15..
How to create a menu that will work only on specific maps?

fysiks 03-28-2012 21:48

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

Originally Posted by bazhenov93 (Post 1677765)
Guys, I need help again......

the code is working, just fine, but you can type /menu and then choose top 15..
How to create a menu that will work only on specific maps?

This is the same question as before.

If you want to block a single option in a menu then you need to edit the menu's code.

bazhenov93 03-28-2012 22:05

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

Originally Posted by fysiks (Post 1677767)
This is the same question as before.

If you want to block a single option in a menu then you need to edit the menu's code.

I just need the code that will check for specific map, and when you choose top15 in menu, then this option will be locked

I DON'T KNOW HOW TO!

fysiks 03-28-2012 22:19

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

Originally Posted by bazhenov93 (Post 1677773)
I just need the code that will check for specific map, and when you choose top15 in menu, then this option will be locked

I DON'T KNOW HOW TO!

The simplest and least efficient method has been stated. Check if the map name matches the map name of the map that you don't want it to work on.


All times are GMT -4. The time now is 08:46.

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