Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- allows only m2 in acer and removes all guns but knife.
- */
- #include < amxmodx >
- #include < reapi >
- new bool:bIsActive;
- new HookChain:fwPreThink;
- new pcvar;
- public plugin_init()
- {
- register_plugin( "[reApi] Acer", "1.0", "DusT" );
- hook_cvar_change( pcvar = create_cvar( "km_stabacer", "1", _, "1: Stab only. 0: disabled", true, 0.0, true, 1.0 ), "@OnStabChange" );
- }
- @OnStabChange( pcvar, const old_value[], const new_value[] )
- {
- if( !bIsActive ) return;
- if( str_to_num( new_value ) == 1 )
- {
- EnableHookChain( fwPreThink );
- }
- else
- {
- DisableHookChain( fwPreThink );
- }
- }
- public plugin_cfg()
- {
- new szMap[ 15 ];
- //get_mapname( szMap, charsmax( szMap ) );
- rh_get_mapname( szMap, charsmax( szMap ), MNT_TRUE );
- if( containi( szMap, "ka_acer_2" ) != -1 )
- {
- bIsActive = true;
- if( get_pcvar_num( pcvar ) == 1 )
- fwPreThink = RegisterHookChain( RG_CBasePlayer_PreThink, "fw_PlayerPreThink" );
- RegisterHookChain( RG_CBasePlayer_Spawn, "fw_Spawn_Post", true );
- }
- }
- public fw_Spawn_Post( id )
- {
- if( !is_user_alive( id ) ) return;
- rg_remove_all_items( id );
- rg_give_item( id, "weapon_knife", GT_REPLACE );
- }
- public fw_PlayerPreThink( id )
- {
- if( !is_user_alive( id ) )
- return;
- static iButton;
- iButton = get_entvar( id, var_button );
- if( iButton & IN_ATTACK )
- {
- set_entvar( id, var_button, ( iButton & ~IN_ATTACK ) | IN_ATTACK2 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement