AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Trouble using bits to register forwards. (https://forums.alliedmods.net/showthread.php?t=189373)

Y060N 07-06-2012 12:08

Trouble using bits to register forwards.
 
I'm trying to register the forwards for main rifles and machine gun only, but it seems as though this isn't working out so well for me.

Can anyone help out? Thanks!

PHP Code:


const NOCLIP_WPN_BS = ((1<<CSW_ELITE)|(1<<CSW_FIVESEVEN)|(1<<CSW_UMP45)|(1<<CSW_USP)|(1<<CSW_GLOCK18)|(1<<CSW_AWP)|(1<<CSW_MP5NAVY)|(1<<CSW_M3)|(1<<CSW_TMP)|(1<<CSW_G3SG1)|(1<<CSW_SG552)|(1<<CSW_HEGRENADE)|(1<<CSW_SMOKEGRENADE)|(1<<CSW_FLASHBANG)|(1<<CSW_KNIFE)|(1<<CSW_C4))

public 
plugin_init()
{

    
register_plugin("blah""1.0""blah")

    for (new 
i=CSW_AUG;i<=CSW_AK47;i++) 
    {         
        if( 
get_weaponname(iszWeaponcharsmax(szWeapon)) )
        {
            if( 
& ~NOCLIP_WPN_BS 1<<)
            {
                
RegisterHamHam_Weapon_PrimaryAttackszWeapon"fw_primary_attack" 
                
RegisterHamHam_Weapon_PrimaryAttackszWeapon"fw_primary_attack_post")
                
RegisterHam(Ham_Weapon_ReloadszWeapon"ham_Reload_Post"1)
            }
        }
    }



Arkshine 07-06-2012 12:59

Re: Trouble using bits to register forwards.
 
i & ~NOCLIP_WPN_BS & 1<<i

->

~NOCLIP_WPN_BS & 1<<i

Y060N 07-06-2012 13:09

Re: Trouble using bits to register forwards.
 
Thanks :)


All times are GMT -4. The time now is 15:20.

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