13.12.2011, 18:19
I've got that:
But it works only sometimes (not always when health goes under 250)
pawn Код:
public OnVehicleDamageStatusUpdate(vehicleid, playerid) //Get called every time a vehicle health changes (I think)
{
new Float:health; //Creating a variable for the car's health
GetVehicleHealth(vehicleid,health); //Storing the actual health of the vehicle in the variable
if(health < 250.0) //Checkin if the health is lower than 400.0 (1000.0 is the max, somewhere around 400.0, it catches fire)
{
new engine, lights, alarm, doors, bonnet, boot, objective; //Creating variable's for the vehicle's parameters (doors, bonnet, engine, etc)
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective); //Getting the vehicle's parameters)
SetVehicleParamsEx(vehicleid, 0, 0, 0, doors, bonnet, boot, objective); //Turning off the engine
SetVehicleHealth(vehicleid,251.0);
SendClientMessage(playerid, 0xFF0000FF, "Your car is broken.");
return 1;
}
return 1;
}
