Vehicle::isTyreBurst: Difference between revisions

From RAGE Multiplayer Wiki
(yay)
 
No edit summary
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
== Summary ==
==Syntax==
The `isTyreBurst` method checks the condition of a specific tire on a vehicle, allowing you to determine if the tire is damaged or fully detached from the rim. This method is useful for creating immersive vehicle mechanics and realistic gameplay interactions, such as controlling a vehicle’s performance based on tire damage or triggering in-game events when tires are burst.
<syntaxhighlight lang="javascript">vehicle.isTyreBurst(wheelID, completely);</syntaxhighlight>
 
=== Required Arguments ===
This function is often used in scenarios where vehicle condition impacts gameplay, like racing games or roleplay servers in RageMP. For example, you might want to slow down a vehicle, reduce handling, or display warnings to players when they have burst tires, enhancing the realism of the driving experience.
*'''wheelID:''' int
 
*'''completely:''' Boolean
'''Note:''' This function is client-side only and uses the `wheelID` parameter to identify the specific wheel, while the `completely` parameter determines whether the check should verify if the tire is fully detached from the rim.
===Return value===
 
*'''Boolean'''
== Wheel ID Values ==
==Example==
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
 
== Syntax ==
<syntaxhighlight lang="javascript">
<syntaxhighlight lang="javascript">
// todo
mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely);
</syntaxhighlight>
</syntaxhighlight>
==See also==
 
=== Parameters ===
* **vehicleHandle** (int): The identifier for the vehicle which you want to check whether the tyre is burst.
* **wheelID** (int): The identifier for the wheel to check.
* **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).
 
== Example ==
<syntaxhighlight lang="javascript">
const wheelID = 0; // Front left wheel
const completely = true;
const vehicle = mp.players.local.vehicle; //Local player vehicle to be used as an example for the method
 
//Note: It’s better to add a check whether the vehicle handle is valid beforehand, otherwise an error might occur.
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_function_c}}
{{Vehicle_function_c}}
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:TODO: Example]]
[[Category:Vehicle Functions]]

Revision as of 10:23, 1 November 2024

Summary

The `isTyreBurst` method checks the condition of a specific tire on a vehicle, allowing you to determine if the tire is damaged or fully detached from the rim. This method is useful for creating immersive vehicle mechanics and realistic gameplay interactions, such as controlling a vehicle’s performance based on tire damage or triggering in-game events when tires are burst.

This function is often used in scenarios where vehicle condition impacts gameplay, like racing games or roleplay servers in RageMP. For example, you might want to slow down a vehicle, reduce handling, or display warnings to players when they have burst tires, enhancing the realism of the driving experience.

Note: This function is client-side only and uses the `wheelID` parameter to identify the specific wheel, while the `completely` parameter determines whether the check should verify if the tire is fully detached from the rim.

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

Syntax

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

Parameters

  • **vehicleHandle** (int): The identifier for the vehicle which you want to check whether the tyre is burst.
  • **wheelID** (int): The identifier for the wheel to check.
  • **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).

Example

const wheelID = 0; // Front left wheel
const completely = true;
const vehicle = mp.players.local.vehicle; //Local player vehicle to be used as an example for the method

//Note: It’s better to add a check whether the vehicle handle is valid beforehand, otherwise an error might occur.
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