Raised This Month: $ Target: $400
 0% 

What can I add to script to ignore the m3


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
ConnorMcLeod
Veteran Member
Join Date: Jul 2006
Location: France (95)
Old 04-15-2009 , 04:00   Re: What can I add to script to ignore the m3
Reply With Quote #6

Best way (most efficient in my mind) to add weapons is to make a bitsum :

PHP Code:
const WEAPONS_BITSUM = (1<<CSW_M3)|(1<<CSW_XM1014
Then in the function make this check :

instead of
PHP Code:
if iWeapon == CSW_M3 
PHP Code:
if( WEAPONS_BITSUM & (1<<iWeapon) ) 
->
PHP Code:
public Player_TraceAttack(idiAttackerFloat:flDamageFloat:vecDir[3], ptriDamageType)
{
    if( 
IsPlayer(iAttacker) &&  WEAPONS_BS & (1<<get_user_weapon(iAttacker)) )
    {
        new 
CsArmorType:tArmoriArmor cs_get_user_armor(idtArmor)
        if(
iArmor && tArmor == CS_ARMOR_VESTHELM    && get_tr2(ptrTR_iHitgroup) == HIT_HEAD)
        {
            
set_tr2(ptrTR_iHitgroupget_pcvar_num(g_cvarSHelmetThreshold) ? HIT_SHIELD HIT_GENERIC)
            return 
HAM_HANDLED
        
}
    }
    return 
HAM_IGNORED

This way you have only 1 check in the function instead of multiples ones.
__________________
- tired and retired -

- my plugins -

Last edited by ConnorMcLeod; 04-16-2009 at 04:53.
ConnorMcLeod is offline
 



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 02:26.


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