19.03.2013, 12:57
(
Последний раз редактировалось Scenario; 19.03.2013 в 13:37.
)
This may or may not work, but you can try it. It uses y_timers and y_hooks.
You could expand on it and run checks to see if the vehicle is flipped on its top. If it is, you could put it back on its wheels to prevent it from blowing up. I'd recommend using a time-stamp to make sure that it isn't "on its top" simply because the driver made it roll...
pawn Код:
new
Timer:healthCheckTimer[MAX_VEHICLES]
;
hook OnVehicleSpawn(vehicleid)
{
healthCheckTimer[vehicleid] = repeat checkVehicleHealth(vehicleid);
return 1;
}
hook OnVehicleDeath(vehicleid)
{
stop healthCheckTimer[vehicleid];
return 1;
}
timer checkVehicleHealth[3000](vehicleid)
{
new
Float:vehicleHealth
;
GetVehicleHealth(vehicleid, vehicleHealth);
if(vehicleHealth < 400.0)
{
foreach(new i : Player)
if(GetPlayerState(i) == PLAYER_STATE_DRIVER)
if(GetPlayerVehicleID(i) == vehicleid) GameTextForPlayer(i, "~w~You broke the vehicle, ~r~idiot~w~!", 3000, 3);
SetVehicleHealth(vehicleid, 400.0);
new engine, lights, alarm, doors, bonnet, boot, objective;
GetVehicleParamsEx(vehicleid, engine, lights, alarm, doors, bonnet, boot, objective);
SetVehicleParamsEx(vehicleid, 0, lights, alarm, doors, bonnet, boot, objective);
}
return 1;
}
