AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Checking weapons (https://forums.alliedmods.net/showthread.php?t=167867)

reinert 09-21-2011 07:13

Checking weapons
 
Is this correct way to check does user got FAMAS ?

PHP Code:

            new weapon get_user_weapon(id__);
            if(
weapon != CSW_FAMAS)
            {
                
dropPrimaryWeapons(id)
                
give_item(id"weapon_famas")
            }
            
cs_set_user_bpammo(idCSW_FAMAS90

If user got FAMAS, backpack ammo refills, if user does not have FAMAS, it drops current primary weapon and gives him FAMAS, and also refills ammo. Is it correct ?

e12harry 09-21-2011 08:40

Re: Checking weapons
 
This only checks if player is holding FAMAS. If he is holding knife, but still has FAMAS he will drop it and than get another.

use
PHP Code:

get_user_weapons(index,weapons[32],&num

to get all weapons player has

reinert 09-21-2011 08:42

Re: Checking weapons
 
Ok thanks.

Bugsy 09-21-2011 09:45

Re: Checking weapons
 
May be easier to do this so you won't need to loop through all carried weapons.
PHP Code:

if ( pevid pev_weapons ) & ( << CSW_FAMAS ) )
{
   
//player has famas



jim_yang 09-21-2011 10:48

Re: Checking weapons
 
user_has_weapon


All times are GMT -4. The time now is 19:34.

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