Vehicle::isTyreBurst: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
wheelID used for 4 wheelers seem to be (0, 1, 4, 5)<br>completely - is to check if tire completely gone from rim.<br><br>*JulioNIB<br>'0 = wheel_lf / bike, plane or jet front<br>'1 = wheel_rf<br>'2 = wheel_lm / in 6 wheels trailer, plane or jet is first one on left<br>'3 = wheel_rm / in 6 wheels trailer, plane or jet is first one on right<br>'4 = wheel_lr / bike rear / in 6 wheels trailer, plane or jet is last one on left<br>'5 = wheel_rr / in 6 wheels trailer, plane or jet is last one on right<br>'45 = 6 wheels trailer mid wheel left<br>'47 = 6 wheels trailer mid wheel right
{{ClientsideJsFunction}}
==Syntax==
{{JSContainer|
<syntaxhighlight lang="javascript">vehicle.isTyreBurst(wheelID, completely);</syntaxhighlight>
 
=== Required Arguments ===
The `isTyreBurst` function checks the condition of a specific vehicle tire, allowing you to determine whether it is burst or fully detached from the rim. This feature is useful for creating realistic vehicle mechanics in gameplay, where a burst tire could affect handling, speed, or trigger in-game events.
*'''wheelID:''' int
 
*'''completely:''' Boolean
This function enables immersive scenarios on roleplay or racing servers by allowing developers to react to tire damage. For example, burst tires might cause reduced control or trigger warnings to the player, adding realism to the driving experience.
===Return value===
 
*'''Boolean'''
 
==Example==
== Wheel ID Values ==
The following are commonly used `wheelID` values for vehicles:
 
* 0 - Front left wheel (also used for bike, plane, or jet front wheel)
* 1 - Front right wheel
* 2 - Middle left wheel (used in 6-wheel trailers, or the first left wheel for planes or jets)
* 3 - Middle right wheel (used in 6-wheel trailers, or the first right wheel for planes or jets)
* 4 - Rear left wheel (also used for the rear wheel of bikes, or the last left wheel on planes or jets)
* 5 - Rear right wheel (or the last right wheel for planes or jets)
* 45 - Middle left wheel on a 6-wheel trailer
* 47 - Middle right wheel on a 6-wheel trailer
 
=== Required Params ===
* '''vehicleHandle:''' {{RageType|int}} - The vehicle handle which the method will check whether the tyre is bursted.
* '''wheelID:''' {{RageType|int}} – The identifier for the wheel to check (see Wheel ID Values above).
* '''completely:''' {{RageType|boolean}} – Set to `true` to check if the tire is fully detached from the rim.
 
=== Return Value ===
* '''{{RageType|boolean}}''' – Returns `true` if the specified tire is burst (and, if `completely` is `true`, fully detached).
 
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely);
</syntaxhighlight>
</syntaxhighlight>
==See also==
 
{{Vehicle_function_c}}
== Example ==
<syntaxhighlight lang="javascript">
const wheelID = 0; // Front left wheel
const completely = true;
const vehicle = mp.players.local.vehicle; // The vehicle we will check if the tyre is bursted.
 
//Note: It’s recommended to check if the vehicle is valid before executing this method.
if (mp.game.vehicle.isTyreBurst(vehicle.handle, wheelID, completely)) {
  mp.gui.chat.push("The front left tire is completely burst.");
} else {
  mp.gui.chat.push("The front left tire is intact.");
}
</syntaxhighlight>
}}
 
== See Also ==
{{Vehicle_functions_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:Vehicle Functions]]

Latest revision as of 11:55, 1 November 2024

Client-Side
Function

 JavaScript



JavaScript Syntax


The `isTyreBurst` function checks the condition of a specific vehicle tire, allowing you to determine whether it is burst or fully detached from the rim. This feature is useful for creating realistic vehicle mechanics in gameplay, where a burst tire could affect handling, speed, or trigger in-game events.

This function enables immersive scenarios on roleplay or racing servers by allowing developers to react to tire damage. For example, burst tires might cause reduced control or trigger warnings to the player, adding realism to the driving experience.


Wheel ID Values

The following are commonly used `wheelID` values for vehicles:

  • 0 - Front left wheel (also used for bike, plane, or jet front wheel)
  • 1 - Front right wheel
  • 2 - Middle left wheel (used in 6-wheel trailers, or the first left wheel for planes or jets)
  • 3 - Middle right wheel (used in 6-wheel trailers, or the first right wheel for planes or jets)
  • 4 - Rear left wheel (also used for the rear wheel of bikes, or the last left wheel on planes or jets)
  • 5 - Rear right wheel (or the last right wheel for planes or jets)
  • 45 - Middle left wheel on a 6-wheel trailer
  • 47 - Middle right wheel on a 6-wheel trailer

Required Params

  • vehicleHandle: int - The vehicle handle which the method will check whether the tyre is bursted.
  • wheelID: int – The identifier for the wheel to check (see Wheel ID Values above).
  • completely: boolean – Set to `true` to check if the tire is fully detached from the rim.

Return Value

  • 'boolean' – Returns `true` if the specified tire is burst (and, if `completely` is `true`, fully detached).

Syntax

mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely);

Example

const wheelID = 0; // Front left wheel
const completely = true;
const vehicle = mp.players.local.vehicle; // The vehicle we will check if the tyre is bursted.

//Note: It’s recommended to check if the vehicle is valid before executing this method.
if (mp.game.vehicle.isTyreBurst(vehicle.handle, wheelID, completely)) {
  mp.gui.chat.push("The front left tire is completely burst.");
} else {
  mp.gui.chat.push("The front left tire is intact.");
}


See Also