10.10.2016, 19:22
Hello. I'm trying to save the damage status of a car. Now, I am using this:
With this, I can save the Health variable every time. But, if I destroy a car on purpose, overturning the car, the car explodes and respawns with 1000 health. What I want is to store, for example the vehicle exploded with 353 of health (like my function does, but this function don't work with overturned cars or cars on water). If the vehicle is beign damaged, when arrives to 353 the Engine stops (this works correctly).
Is there any function where I can set the health or don't respawn the car again if the car is destroyed?
Thanks!
Код:
public OnFilterScriptInit() { LoadVehicles(); for(new a = 0; a < MAX_VEHICLES; a++) { timerLife = SetTimerEx("carHealth", 1000, 1, "i", a); } return 1; } public carHealth(id) { if (id != INVALID_VEHICLE_ID) { if(Vehicle[VehicleIDX(id)][Created]) { new Float:health; GetVehicleHealth(id, health); Vehicle[id][Health] = health; if(health < 352) { SetVehicleHealth(id, 353); SetVehicleParamsEx(id, VEHICLE_PARAMS_OFF, -1, -1, -1, -1, -1, -1); Engine[id] = 0; } } } return 1; }
Is there any function where I can set the health or don't respawn the car again if the car is destroyed?
Thanks!