hasWeapon: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
No edit summary
Line 1: Line 1:
[[Category:Scripting Commands|HASWEAPON]]
{{Command|= Comments
[[Category:Scripting Commands OFP 1.96|HASWEAPON]]
____________________________________________________________________________________________
[[Category:Scripting Commands OFP 1.46|HASWEAPON]]
[[Category:Scripting Commands ArmA|HASWEAPON]]


| ofp |= Game name


<h2 style="color:#000066">'''''unit'' hasWeapon ''weaponName'''''</h2>
|1.00|= Game version


|arg= global |= Arguments in MP
____________________________________________________________________________________________


'''Operand types:'''
| Checks if a unit has the given weapon. |= Description
____________________________________________________________________________________________


'''unit:''' [[Object]]
| unit '''hasWeapon''' weapon |= Syntax


'''weaponName:''' [[String]]
|p1= unit: [[Object]] |= Parameter 1


'''Type of returned value:'''
|p2= weapon: [[String]] - the name of the weapon to check for. |= Parameter 2


[[Boolean]]
| [[Boolean]]
Returns true if the unit has the weapon, false if not. |= Return value
____________________________________________________________________________________________
 
|x1= <pre>?!(player hasWeapon "M16") : player addWeapon "M16"</pre> |= Example 1
____________________________________________________________________________________________


'''Description:'''
| [[weapon]] |= See also


Check if unit has given weapon.
}}


<h3 style="display:none">Notes</h3>
<dl class="command_description">
<!-- Note Section BEGIN -->


'''Example:'''
<!-- Note Section END -->
</dl>


? ([[player]] '''hasWeapon''' "M16") : [[goto]] "ready"
<h3 style="display:none">Bottom Section</h3>
[[Category:Scripting Commands|HASWEAPON]]
[[Category:Scripting Commands OFP 1.96|HASWEAPON]]
[[Category:Scripting Commands OFP 1.46|HASWEAPON]]
[[Category:Scripting Commands ArmA|HASWEAPON]]

Revision as of 00:28, 2 August 2006

Hover & click on the images for description

Description

Description:
Checks if a unit has the given weapon.
Groups:
Uncategorised

Syntax

Syntax:
unit hasWeapon weapon
Parameters:
unit: Object
weapon: String - the name of the weapon to check for.
Return Value:
Boolean - Returns true if the unit has the weapon, false if not.

Examples

Example 1:
?!(player hasWeapon "M16") : player addWeapon "M16"

Additional Information

See also:
weapon

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note

Notes

Bottom Section