Vehicle::setDoorOpen
Opens the door of the vehicle.
doorIndex:
- 0 = Front Left Door
- 1 = Front Right Door
- 2 = Back Left Door
- 3 = Back Right Door
- 4 = Hood
- 5 = Trunk
- 6 = Back
- 7 = Back2
Syntax
vehicle.setDoorOpen(doorIndex, loose, openInstantly);
Required Arguments
- doorIndex: Int
- loose: Boolean
- openInstantly: Boolean
Return value
- Undefined
Example
When in a vehicle, pressing the N key will open/close the hood
Client-Side
mp.keys.bind(0x4E, true, function() { // N Key
if(mp.players.local.vehicle){
if (mp.players.local.vehicle.hood){
mp.players.local.vehicle.hood = false;
mp.players.local.vehicle.setDoorShut(4, true);
} else {
mp.players.local.vehicle.hood = true;
mp.players.local.vehicle.setDoorOpen(4, false, true);
}
}
});