Jump to content
Sign in to follow this  
Pac Man

Detecting if an item is a magazine or weapon or if it's in cfgmagazines or cfgWeapons

Recommended Posts

How would I detect if any given item is a weapon type or a magazine type? Or detect if any given item / object is in cfgMagazines or cfgWeapons or cfgVehicles?

IE;

if ("m16" isKindOf magazine) then { do stuff } else { do other stuff };

if ("m16" in cfgMagazines) then { do stuff } else { do other stuff };

Thanks.

Kind Regards,

Pac Man

Share this post


Link to post
Share on other sites
if ( isClass (configFile >> "CFGweapons" >> _item)) then {
   //is weapon
}else{
   if ( isClass (configFile >> "CFGMagazines" >> _item)) then {
       //is magazine
   }else{
       //is some other class
   };
};

Was the way i was doing it earlier today while sorting inventory items. see here (specifically _containerItems in the second bit of code)

Edited by Larrow

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×