- Documentation
- Shared functions
- fixVehicle
Function
fixVehicle
Repairs 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.
Syntax
bool fixVehicle(vehicle vehicle)Arguments
vehiclevehicle- The vehicle to repair.
Returns
true on success.
Example
addCommandHandler("napraw", function(player)
local vehicle = getPedOccupiedVehicle(player)
if vehicle then
fixVehicle(vehicle)
outputChatBox("Pojazd naprawiony.", player, 0, 200, 0)
end
end)
Notes
Client. In a client script it repairs the vehicle in this game; a vehicle this player drives passes its state on through sync, so others see the repair too.
See also
blowVehicleDestroys a vehicle: health drops to 0, the engine stops, the vehicle becomes a wreck (isVehicleBlown=true) and theonVehicleExplodeevent fires. By default every player also sees an explosion. If respawning is enabled for the vehicle (toggleVehicleRespawn, off by default), the wreck returns to its spawn point after the time set withsetVehicleRespawnDelay(10 s by default); without respawning the wreck disappears after the time fromsetVehicleWreckDelay(20 s by default). Blowing up an already destroyed vehicle does nothing.setElementHealthSets an element's health.0kills a player or ped and firesonPlayerWasted/onPedWasted.setVehicleDoorStateSets 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.