- Documentation
- Server functions
- setVehicleDoorState
Function
setVehicleDoorState
Sets the state of one door (or the bonnet or boot) of a vehicle for every player: shut, ajar, dented or missing. Door numbers: 0 bonnet, 1 boot, 2 front left, 3 front right, 4 rear left, 5 rear right. A vehicle without that door simply will not show it.
Syntax
bool setVehicleDoorState(vehicle vehicle, int door, int state)Arguments
vehiclevehicle- The vehicle.
doorint- Door number 0-5 (see above).
stateint- 0 shut, 1 ajar, 2 shut and damaged, 3 ajar and damaged, 4 missing.
Returns
true on success, false for an out-of-range number.
Example
local vehicle = createVehicle(400, 2000, -1700, 13.5)
setVehicleDoorState(vehicle, 0, 4)
setVehicleDoorState(vehicle, 2, 3)
See also
getVehicleDoorStateReturns the state of one door of a vehicle (0 shut, 1 ajar, 2 shut and damaged, 3 ajar and damaged, 4 missing). Door numbering as insetVehicleDoorState.setVehicleDoorOpenRatioOpens a door, the bonnet or the boot of a vehicle to the given degree for every player: 0 = shut, 1 = wide open, 0.5 = halfway. Useful e.g. in a workshop (open bonnet) or when searching the boot. Door numbering as insetVehicleDoorState.fixVehicleRepairs a vehicle to factory condition: 1000 health, and every door, body panel, lamp and wheel returns to undamaged; a wreck stops being a wreck. It also cancels a scheduled wreck respawn. For one second after the repair the server ignores damage reports from the game so the old damage does not come back. Colour, tuning and plate stay as they were.