Wombat241 0 Posted March 4, 2006 Does anyone know how to tell if someone has a pistol or a law launcher etc out, because I need it for my flashlight v2, which I wont release unless wanted. It'd be great for the help. Rommel/Wombat. Share this post Link to post Share on other sites
Garcia 0 Posted March 4, 2006 <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (unitname hasweapon "weaponclassname") :unitname chat "I've got weapon" that'll check if a unit named unitname got the weapon you place replace weaponclassname with, and if he got it. to check if a unit named unit1 got a m16, you write this: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? (unit1 hasweapon "m16") : unit1 sidechat "I've got a m16" Share this post Link to post Share on other sites
Wombat241 0 Posted March 4, 2006 I knew that, but I wondering if there was a more universal command, anyway, is that for what he is holding of if he just has it, cause I need to if he is holding it. Share this post Link to post Share on other sites
thobson 38 Posted March 4, 2006 For secondary weapons try: Quote[/b] ]secondaryWeapon vehicleOperand types: Â Â vehicle: Object Compatibility: Â Â Version 1.75 required. Type of returned value: Â Â String Description: Â Â Returns name of vehicle's secondary weapon (empty string if none). Example: Â Â secondaryWeapon player NB: You can tell what weapons a unit has - but not which one he is holding. This is a real pain. Also look at: Quote[/b] ]weapons vehicleOperand types: Â Â vehicle: Object Compatibility: Â Â Version 1.75 required. Type of returned value: Â Â Array Description: Â Â Returns array of names of all vehicle's weapons.. Example: Â Â weapons player So for eaxmple to check if a unit has no weapons use the condition: count weapons unitname < 1 To check if a unit has a specific weapon either use hasWeapon as described above by Garcia or you could do something like: if ("m16" in weapons unitname) then {hint"got an M16"} Share this post Link to post Share on other sites
nominesine 0 Posted March 4, 2006 if ("m16" in weapons unitname) then {hint"got an M16"} Lets say I want to check if any groupmember in my group named heroes is carrying an m16. The individual soldiers in the group are named h1,h2,h3... et cetera. Do I need to make the check fo each individual soldier, or can I somehow pass an array of soldier names to be checked. How would the syntax read? Share this post Link to post Share on other sites
Garcia 0 Posted March 4, 2006 something like <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">? ({"m16" in weapons _x} foreach (units heroes)): hint "got an M16" Share this post Link to post Share on other sites
thobson 38 Posted March 4, 2006 I think: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">if ({"m16" in weapons _x} count units heroes > 0) then {hint"At least one M16 in the group"} Or some such Share this post Link to post Share on other sites
nominesine 0 Posted March 5, 2006 Thanks Thobson. That's what I needed. Share this post Link to post Share on other sites
Wombat241 0 Posted March 10, 2006 Well thanks, I already knew the stuff you posted, I guess trying to find out if he is holding a secondary weapon isnt possible. Even though I somehow did it before.... Share this post Link to post Share on other sites