View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-02-2023 , 17:08   Re: native "get_user_weapon"
Reply With Quote #4

PHP Code:
#define DMG_FALL    (1<<5)

public TakeDamagethis idinflictor idattacker Float:damage damagebits )
{
    new 
bool:bDmgUpdated;
    
    if ( !( 
damagebits DMG_FALL ) )
    {
        new 
iAttackerWeapon get_user_weaponidattacker );
        
bDmgUpdated true;
        
        switch ( 
iAttackerWeapon )
        {
            
//case CSW_AWP: //This is not needed as setting the damage to damage * 1 is the same as regular damage.
            //{
            //    SetHamParamFloat( 4 , damage * 1.0 )
            //}
            
case CSW_KNIFE:
            {
                
SetHamParamFloatdamage 1.5 )
            }
            case 
CSW_HEGRENADE:
            {
                if( 
idattacker != idinflictor )
                {
                    
SetHamParamFloatdamage 6.0 )
                }
            }
            default:
            {
                
SetHamParamFloatdamage 3.0 )
            }
        }
    }
    
    return 
bDmgUpdated HAM_HANDLED HAM_IGNORED;

__________________

Last edited by Bugsy; 04-02-2023 at 17:09.
Bugsy is offline