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

Propper weapon restriction on specific map.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
rederlt
Member
Join Date: Jul 2007
Location: Lithuania
Old 12-05-2008 , 08:30   Propper weapon restriction on specific map.
Reply With Quote #1

I need to Restrict Specfic weapons on Specific map..
In de_dust all weapons on and in fy_iceworld only knifes.. What to do? What is the best plugin to do that?

So Far i Tried:
restmenu.amxx
http://forums.alliedmods.net/showthread.php?t=49798

in /configs/amxx.cfg
Code:
amx_restrict OFF
in /configs/maps/fy_iceworld.cfg
Code:
amx_restrict load knaif.cfg
in /configs/knaif.cfg

Code:
glock            ; Glock18 Select Fire
deagle           ; Desert Eagle .50AE
p228             ; SIG P228
elites           ; Dual Beretta 96G Elite
fn57             ; FN Five-Seven
ak47             ; AK-47
galil            ; Gali
famas            ; Famas
m4a1             ; Colt M4A1 Carbine
m249             ; FN M249 Para
hegren           ; HE Grenade
Rezult. All maps with no weapons that was in knaif.cfg :/
Any suggestions ? What plugin is best for me ?
__________________
_________________________________
I've got lots of ideas and I'd like that you
check them.
rederlt is offline
Send a message via Skype™ to rederlt
anakin_cstrike
Veteran Member
Join Date: Nov 2007
Location: Romania
Old 12-05-2008 , 09:41   Re: Propper weapon restriction on specific map.
Reply With Quote #2

Something like this
PHP Code:
#include <amxmodx>

// write here the maps in wich you want only knife
new g_OnlyKnife[ ][ ] = 
{
    
"fy_iceworld",
    
"fy_snow"
};

new 
boolg_Knife false;

public 
plugin_init() 
{
    new 
map32 ], i;
    
get_mapnamemapsizeof map );
    
    for( 
0sizeof g_OnlyKnifei++ )
    {
        if( 
equalimapg_OnlyKnife] ) )
            
g_Knife true;
    }
    
    
register_event"CurWeapon""hook_curwpn""be""1=1""2!29");
}

public 
hook_curwpnid )
{
    if( !
g_Knife )
        return 
0;
    
    
engclient_cmdid"weapon_knife" );
    
    return 
0;

__________________

anakin_cstrike is offline
Dores
Veteran Member
Join Date: Jun 2008
Location: You really don't wanna k
Old 12-06-2008 , 12:45   Re: Propper weapon restriction on specific map.
Reply With Quote #3

This will prevent the player from buying restricted weapons if the current map is at the knife_only_maps.ini file (that you must create at /addons/amxmodx/configs folder).
This will also prevent weapons and armor from spawning.

An example of knife_only_maps.ini:
Code:
fy_iceworld
de_dust
de_dust2
// etc...
CVars:

kom_on <1 | 0> - toggles the plugin on (1) or off (0).
kom_nades <1 | 0> - toggles grenades restriction on (1) or off (0).
kom_armor <1 | 0> - toggles armor restriction on (1) or off (0).

Requires the FakeMeta module.

Code:
<amxmodx>
<fakemeta>

#define VERSION    "1.0"

#define KNIFE_ONLY_MAPS_INI    "knife_only_maps.ini"

new p_On, p_Nades, p_Armor;
new bool:g_Knives;

new const g_Guns_buy_cmds[][] =
{
    "glock",
    "usp",
    "tmp",
    "mp5",
    "autoshotgun",
    "m4a1",
    "ak47",
    "galil",
    "famas",
    "shield",
    "p228",
    "deagle",
    "fn57",
    "mac10",
    "ump45",
    "p90",
    "scout",
    "sg552",
    "awp",
    "g3sg1",
    "famas",
    "bullpup",
    "sg550",
    "m249"
}

new const g_Nades_buy_cmds[][] =
{
    "flash",
    "hegren",
    "sgren"
}

new const g_Armor_buy_cmds[][] =
{
    "vest",
    "vesthelm"
}

public plugin_precache()
{
    static file[ 62 ];
    get_configsdir( file, charsmax( file ) );
    add( file, charsmax( file ), KNIFE_ONLY_MAPS_INI );
    
    static iMap[ 30 ], KnivesMap[ 30 ], f;
    get_mapname( iMap, charsmax( iMap ) );
    if( file_exists( file ) )
    {
        f = fopen( file, "r" );
    
        do
        {
            fgets( f, KnivesMap, charsmax( KnivesMap ) );
            
            if( KnivesMap[ 0 ] )
            {
                if( equali( iMap, KnivesMap ) )
                {
                    g_Knives = true;
                }
            }
        }
        while( !feof( f ) );
        
        fclose( f );
    }
    
    register_forward( FM_Spawn, "Forward_Spawn" );
}

public plugin_init()
{
    register_plugin( "Knife Only Maps", VERSION, "Dores" );
    p_On = register_cvar( "kom_on", "1" );
    p_Nades = register_cvar( "kom_nades", "1" );
    p_Armor = register_cvar( "kom_armor", "1" );
}

public server_changelevel( const map[] )
{
    g_Knives = false;
}

public client_command( id )
{
    if( get_pcvar_num( p_On ) && g_Knives )
    {
        static iCmd[ 13 ];    read_argv( 0, iCmd, charsmax( iCmd ) );
        static i;
        
        if( get_pcvar_num( p_Nades ) )
        {
            for( i = 0 ; i < sizeof g_Nades_buy_cmds ; i++ )
            {
                if( equali( iCmd, g_Nades_buy_cmds[ i ] ) )
                {
                    console_print( id, "You can't buy grenades in this map." );
                    return PLUGIN_HANDLED;
                }
            }
        }
        
        if( get_pcvar_num( p_Armor ) )
        {
            for( i = 0 ; i < sizeof g_Armor_buy_cmds ; i++ )
            {
                if( equali( iCmd, g_Armor_buy_cmds[ i ] ) )
                {
                    console_print( id, "You can't buy armor in this map." );
                    return PLUGIN_HANDLED;
                }
            }
        }
        
        for( i = 0 ; i < sizeof g_Guns_buy_cmds ; i++ )
        {
            if( equali( iCmd, g_Gun_buy_cmds[ i ] ) )
            {
                console_print( id, "You can't buy guns in this map." );
                return PLUGIN_HANDLED;
            }
        }
    }
    
    return PLUGIN_CONTINUE;
}

public Forward_Spawn( ent )
{
    if( get_pcvar_num( p_On ) && g_Knives )
    {
        static c_Model[ 26 ];    pev( ent, pev_model, c_Model, charsmax( c_Model ) );
        static c_Classname[ 22 ];    pev( ent, pev_classname, c_Classname, charsmax( c_Classname ) );
        
        if( equal( c_Model, "models/w_kevlar.mdl" ) && get_pcvar_num( p_Armor ) )
        {
            return FMRES_HANDLED;
        }
        
        if( equal( c_Classname, "weaponbox" ) )
        {
            return FMRES_HANDLED;
        }
    }
    
    return FMRES_IGNORED;
}
Attached Files
File Type: ini knife_only_maps.ini (74 Bytes, 201 views)
__________________
O o
/Ż________________________
| IMMA FIRIN' MAH LAZOR!!!
\_ŻŻŻ
Dores is offline
rederlt
Member
Join Date: Jul 2007
Location: Lithuania
Old 12-07-2008 , 13:31   Re: Propper weapon restriction on specific map.
Reply With Quote #4

And what if there is Awp map or Usp map.. i have some maps that i need to use only awp or usp.
I need because im using Roll The Dice :/
__________________
_________________________________
I've got lots of ideas and I'd like that you
check them.
rederlt is offline
Send a message via Skype™ to rederlt
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 12-07-2008 , 13:36   Re: Propper weapon restriction on specific map.
Reply With Quote #5

i think u dont need any plugins.

make a folder in configs names maps. put there the map configs. like :

addons/amxx/configs/maps/fy_iceworld.cfg

& in the config u can restrict any weapon. i cant remember the command to restrice. ( we imagin just the command is res "weapon" )

there u can type res "m4" or ..... like in the amxx.cfg
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-07-2008 , 14:17   Re: Propper weapon restriction on specific map.
Reply With Quote #6

There isn't any command to restrict weapons. Still there is restrict menu and using that the command could be done as well.

Last edited by SnoW; 12-07-2008 at 14:17. Reason: typo
SnoW is offline
Send a message via MSN to SnoW
rederlt
Member
Join Date: Jul 2007
Location: Lithuania
Old 12-07-2008 , 14:19   Re: Propper weapon restriction on specific map.
Reply With Quote #7

I did that but .. still weapons from Roll The Dice is usable,not pickable not buyable but when you win you can shoot freeely :////
__________________
_________________________________
I've got lots of ideas and I'd like that you
check them.
rederlt is offline
Send a message via Skype™ to rederlt
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 12-07-2008 , 14:35   Re: Propper weapon restriction on specific map.
Reply With Quote #8

I don't really get why do you want a plugin, that makes some weapons not usable, when at the same time other plugin gives them. You should edit the rtd and delete the changes you don't want.
SnoW is offline
Send a message via MSN to SnoW
rederlt
Member
Join Date: Jul 2007
Location: Lithuania
Old 12-07-2008 , 14:41   Re: Propper weapon restriction on specific map.
Reply With Quote #9

Im not smart enough :/
__________________
_________________________________
I've got lots of ideas and I'd like that you
check them.
rederlt is offline
Send a message via Skype™ to rederlt
rederlt
Member
Join Date: Jul 2007
Location: Lithuania
Old 12-08-2008 , 04:48   Re: Propper weapon restriction on specific map.
Reply With Quote #10

http://forums.alliedmods.net/showpos...&postcount=370
Could you check this modification? It aint work i thing it needs a little attention.. Creator dont reply to me :/
__________________
_________________________________
I've got lots of ideas and I'd like that you
check them.
rederlt is offline
Send a message via Skype™ to rederlt
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:11.


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