getPartDamageLevel
Used to get
get the current damage level of a part.
Parts
{
FrontLeft: 0,
FrontRight: 1,
MiddleLeft: 2,
MiddleRight: 3,
RearLeft: 4,
RearRight: 5,
}
Part Damage Types
{
NotDamaged: 0,
DamagedLevel1: 1,
DamagedLevel2: 2,
DamagedLevel3: 3,
}
Returns a number
.
Declaration
vehicle.getPartDamageLevel(partId: VehiclePart): number
Usage
const damageAmount = vehicle.getPartDamageLevel(0);
Real World Example
const vehicle = new alt.Vehicle(`elegy`, 0, 0, 0, 0, 0, 0);
const damageAmount = vehicle.getPartDamageLevel(0);
if (damageAmount >= 1) {
console.log(`Elegy has ${damageAmount} is damaged.`);
}
These examples assume you have vehicle created or available on server-side