View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 12-17-2023 , 20:55   Re: CurWeapon event will fire on Fire
Reply With Quote #6

This will only fire on a true weapon switch, not when a new weapon is picked up or purchased.

Edit: Just realized WATCH_D0GS UNITED posted essentially the same thing. I saw a lot of orange in his post & assumed it was psuedo-code and it was TLDR so I skipped over it.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <cstrike>
#include <fakemeta>
#include <hamsandwich>

new const Version[] = "0.1";

const 
IGNORE_ITEMS = ( ( << CSW_HEGRENADE ) | ( << CSW_SMOKEGRENADE ) | ( << CSW_FLASHBANG ) | ( << CSW_C4 ) );

public 
plugin_init() 
{
    
register_plugin"Admin Weapon Switch" Version "bugsy" );
    
    for ( new 
iWeaponID CSW_P228 szWeaponName23 ]; iWeaponID <= CSW_P90 iWeaponID++ )
    {
        if ( !( 
IGNORE_ITEMS & ( << iWeaponID ) ) && get_weaponnameiWeaponID szWeaponName charsmaxszWeaponName ) ) )
            
RegisterHamHam_Item_Deploy szWeaponName "DeployWeapon" );
    }
    
}

public 
DeployWeaponiEntity )
{
    new 
id peviEntity pev_owner );
    
    if ( ( 
<= id <= MAX_PLAYERS ) && is_user_adminid ) )
    {
        new 
szWeaponName23 ];
        new 
iWeaponID cs_get_weapon_idiEntity );
        
get_weaponnameiWeaponID szWeaponName charsmaxszWeaponName ) );
        
        
client_printprint_chat "Admin switched to %s" szWeaponName] );
    }

__________________

Last edited by Bugsy; 12-17-2023 at 21:00.
Bugsy is offline