03.08.2015, 15:41
(
Последний раз редактировалось RIDE2DAY; 03.08.2015 в 17:34.
)
You must keep in mind that the SA-MP Wiki says "this does not include vehicle health changes" in OnVehicleDamageStatusUpdate, so... I guess you know you're able to put a car on fire (decrease its health) shooting it without damaging any of its components (panels, doors, lights, tires).
Anyway, you might use a global timer to check all vehicles' health.
EDIT #1: global timer.
Anyway, you might use a global timer to check all vehicles' health.
EDIT #1: global timer.
PHP код:
public OnGameModeInit()
{
SetTimer("CheckVehHealth", 1000, true);
return 1;
}
forward CheckVehHealth();
public CheckVehHealth()
{
new Float:g_VehHealth;
for(new x = 1, t = GetVehiclePoolSize(); x <= t; x++)
{
if(!GetVehicleModel(x)) continue;
GetVehicleHealth(x, g_VehHealth);
if(g_VehHealth < 250.0)
{
SetVehicleHealth(x, 250.0);
/* Check vehicle's health status here: https://sampwiki.blast.hk/wiki/VehicleHealth */
}
}
return 1;
}