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

How to block some commands on a Specific map?


Post New Thread Reply   
 
Thread Tools Display Modes
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-15-2012 , 10:09   Re: How to block some commands on a Specific map?
Reply With Quote #21

Quote:
Originally Posted by Exolent[jNr] View Post
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 is offline
bazhenov93
Veteran Member
Join Date: Oct 2010
Old 03-15-2012 , 10:20   Re: How to block some commands on a Specific map?
Reply With Quote #22

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

Last edited by bazhenov93; 03-15-2012 at 10:25.
bazhenov93 is offline
killergirl
Senior Member
Join Date: Jul 2010
Old 03-15-2012 , 10:42   Re: How to block some commands on a Specific map?
Reply With Quote #23

Simple warnings, you can ignore them.
killergirl is offline
Devil259
Veteran Member
Join Date: Dec 2009
Location: France (59)
Old 03-15-2012 , 12:24   Re: How to block some commands on a Specific map?
Reply With Quote #24

Quote:
Originally Posted by Exolent[jNr] View Post
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.
__________________
You can do anything you set your mind to, man.

Devil259 is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-15-2012 , 13:52   Re: How to block some commands on a Specific map?
Reply With Quote #25

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 }

Last edited by Xvil; 03-15-2012 at 13:52.
Xvil is offline
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 03-15-2012 , 13:59   Re: How to block some commands on a Specific map?
Reply With Quote #26

Quote:
Originally Posted by Xvil View Post
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 View Post
.Dare Devil. is offline
Old 03-15-2012, 14:03
Xvil
This message has been deleted by Xvil. Reason: Nothink
killergirl
Senior Member
Join Date: Jul 2010
Old 03-15-2012 , 14:05   Re: How to block some commands on a Specific map?
Reply With Quote #27

killergirl is offline
Xvil
BANNED
Join Date: Feb 2012
Old 03-15-2012 , 14:13   Re: How to block some commands on a Specific map?
Reply With Quote #28

Xvil is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 03-15-2012 , 14:19   Re: How to block some commands on a Specific map?
Reply With Quote #29

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.
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Old 03-15-2012, 14:23
bazhenov93
This message has been deleted by bazhenov93.
.Dare Devil.
Veteran Member
Join Date: Sep 2010
Old 03-15-2012 , 14:25   Re: How to block some commands on a Specific map?
Reply With Quote #30

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..
.Dare Devil. 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 10:21.


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