getExtra
Used to get
the current extra of a vehicle. Which means things like props that spawn in the trunk of a vehicle.
Caveat for this is that IDs are rumored to go up to 14. However, there could be more extra IDs. You can use vehicle.hasExtra
with the specified ID to determine whether or not it has an extra attached.
Returns a number
.
Declaration
vehicle.getExtra(someID: number): number;
Usage
const someExtra = vehicle.getExtra(0);
Real World Example
const vehicle = new alt.Vehicle('dloader', 0, 0, 0, 0, 0, 0);
for(let i = 0; i < 14; i++) {
const hasExtra = vehicle.hasExtra(i);
if (hasExtra) {
const extraValue = vehicle.getExtra(i);
console.log(`Has Extra at: ${i} with value ${extraValue}`);
}
}
These examples assume you have vehicle created or available on server-side