Vehicle::isTyreBurst: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
No edit summary
 
Line 39: Line 39:


//Note: It’s recommended to check if the vehicle is valid before executing this method.
//Note: It’s recommended to check if the vehicle is valid before executing this method.
if (mp.game.vehicle.isTyreBurst(vehicleHandle, wheelID, completely)) {
if (mp.game.vehicle.isTyreBurst(vehicle.handle, 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 {

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