Vehicle::isHeliPartBroken: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
(Added knowledge)
Line 1: Line 1:
 
Returns if any of the heli parts selected as boolean arguments is broken (they pretty much work like bit flags).
{{ClientsideJsFunction}}
{{JSContainer|
==Syntax==
==Syntax==
<syntaxhighlight lang="javascript">vehicle.isHeliPartBroken(p1, p2, p3);</syntaxhighlight>
<syntaxhighlight lang="javascript">vehicle.isHeliPartBroken(mainRotor, tailRotor, tail);</syntaxhighlight>
=== Required Arguments ===
=== Required Arguments ===
*'''p1:''' Boolean
*'''mainRotor:''' Boolean
*'''p2:''' Boolean
*'''tailRotor:''' Boolean
*'''p3:''' Boolean
*'''tail:''' Boolean
===Return value===
===Return value===
*'''Boolean'''
*'''Boolean''' - if anything matching your selection is broken.
 
'''Note:''' If the tail is broken, the tail rotor is broken too!
==Example==
==Example==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
const veh = mp.players.local.vehicle
 
if(veh.isHeliPartBroken(true, false, false)) {
// main rotor is broken
}
if(veh.isHeliPartBroken(false, true, false)) {
// tail rotor is broken
}
if(veh.isHeliPartBroken(false, false, true)) {
// the whole tail is ripped off
}
 
if(veh.isHeliPartBroken(true, true, false)) {
// any of the rotors are broken
}
if(veh.isHeliPartBroken(true, false, true)) {
// the main rotor or something related to the tail is broken
}
if(veh.isHeliPartBroken(false, true, true)) {
// something related to the tail is broken
}
 
if(veh.isHeliPartBroken(true, true, true)) {
// something is broken, you just don't know what.
}
</syntaxhighlight>
</syntaxhighlight>
}}
==See also==
==See also==
{{Vehicle_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:TODO: Example]]

Revision as of 11:57, 17 February 2019

Returns if any of the heli parts selected as boolean arguments is broken (they pretty much work like bit flags).

Client-Side
Function

 JavaScript



JavaScript Syntax

Syntax

vehicle.isHeliPartBroken(mainRotor, tailRotor, tail);

Required Arguments

  • mainRotor: Boolean
  • tailRotor: Boolean
  • tail: Boolean

Return value

  • Boolean - if anything matching your selection is broken.

Note: If the tail is broken, the tail rotor is broken too!

Example

const veh = mp.players.local.vehicle

if(veh.isHeliPartBroken(true, false, false)) {
	// main rotor is broken
}
if(veh.isHeliPartBroken(false, true, false)) {
	// tail rotor is broken
}
if(veh.isHeliPartBroken(false, false, true)) {
	// the whole tail is ripped off
}

if(veh.isHeliPartBroken(true, true, false)) {
	// any of the rotors are broken
}
if(veh.isHeliPartBroken(true, false, true)) {
	// the main rotor or something related to the tail is broken
}
if(veh.isHeliPartBroken(false, true, true)) {
	// something related to the tail is broken
}

if(veh.isHeliPartBroken(true, true, true)) {
	// something is broken, you just don't know what.
}


See also