SetVehicleHealth
Description:
Function SetVehicleHealth set a vehicle's health. When a vehicle's health decreases the engine will produce smoke, and finally fire when it decreases to less than 250 (25%).
Full vehicle health is 1000. Higher values are possible. For more information on health values, see this page. |
Parameters:
(vehicleid, Float:health)
int | vehicleid |
float | health |
Return Values:
- 1: The function was executed successfully.
- 0: The function failed to execute. This means the vehicle does not exist.
Examples:
if(strcmp("/fixengine", cmdtext, true) == 0) { new vehicleid = GetPlayerVehicleID(playerid); SetVehicleHealth(vehicleid, 1000); SendClientMessage(playerid, COLOUR_WHITE, "The vehicles engine has been fully repaired."); return 1; }
Related Functions
The following functions may be useful, as they are related to this function in one way or another.
- GetVehicleHealth: Check the health of a vehicle.
- RepairVehicle: Fully repair a vehicle.
- SetPlayerHealth: Set a player's health.
Related Callbacks
The following callbacks might be useful as well, as they are related to this callback in one way or another.
- OnVehicleDeath: Called when a vehicle is destroyed.