Vehicle::isTyreBurst: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
Line 1: Line 1:
== Summary ==
{{ClientsideJsFunction}}
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.
{{JSContainer|


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.
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.


'''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 ==
== Wheel ID Values ==
The following are commonly used `wheelID` values for vehicles:
The following are commonly used `wheelID` values for vehicles:


* **0** - Front left wheel (also used for bike, plane, or jet front wheel)
* 0 - Front left wheel (also used for bike, plane, or jet front wheel)
* **1** - Front right wheel
* 1 - Front right wheel
* **2** - Middle left wheel (used in 6-wheel trailers, or the first left wheel for planes or jets)
* 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)
* 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)
* 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)
* 5 - Rear right wheel (or the last right wheel for planes or jets)
* **45** - Middle left wheel on a 6-wheel trailer
* 45 - Middle left wheel on a 6-wheel trailer
* **47** - Middle right 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 ==
== Syntax ==
Line 22: Line 31:
mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely);
mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely);
</syntaxhighlight>
</syntaxhighlight>
=== 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 ==
== Example ==
Line 35: Line 36:
const wheelID = 0; // Front left wheel
const wheelID = 0; // Front left wheel
const completely = true;
const completely = true;
const vehicle = mp.players.local.vehicle; //Local player vehicle to be used as an example for the method
const vehicle = mp.players.local.vehicle; // The vehicle we will check if the tyre is bursted.


//Note: It’s better to add a check whether the vehicle handle is valid beforehand, otherwise an error might occur.
//Note: It’s recommended to check if the vehicle is valid before executing this method.
if (mp.game.vehicle.isTyreBurst(vehicle.handle, wheelID, completely)) {
if (mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely)) {
   mp.gui.chat.push("The front left tire is completely burst.");
   mp.gui.chat.push("The front left tire is completely burst.");
} else {
} else {
Line 44: Line 45:
}
}
</syntaxhighlight>
</syntaxhighlight>
}}


== See Also ==
== See Also ==
{{Vehicle_function_c}}
{{Vehicle_functions_c}}
 
[[Category:Clientside API]]
[[Category:Clientside API]]
[[Category:Vehicle Functions]]
[[Category:Vehicle Functions]]

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(vehicleHandle, 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