How to stop vehicles from blowing up?
#5

This may or may not work, but you can try it. It uses y_timers and y_hooks.

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;
}
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...
Reply


Messages In This Thread
How to stop vehicles from blowing up? - by Yves - 19.03.2013, 12:46
Respuesta: How to stop vehicles from blowing up? - by Xabi - 19.03.2013, 12:50
Re: How to stop vehicles from blowing up? - by Private200 - 19.03.2013, 12:51
Re: How to stop vehicles from blowing up? - by Konstantinos - 19.03.2013, 12:52
Re: How to stop vehicles from blowing up? - by Scenario - 19.03.2013, 12:57
Re: How to stop vehicles from blowing up? - by Yves - 19.03.2013, 13:04
Re: How to stop vehicles from blowing up? - by Scenario - 19.03.2013, 13:35
Re: How to stop vehicles from blowing up? - by Yves - 19.03.2013, 13:45
Re: How to stop vehicles from blowing up? - by Scenario - 19.03.2013, 14:00
Re: How to stop vehicles from blowing up? - by Yves - 19.03.2013, 14:09

Forum Jump:


Users browsing this thread: 5 Guest(s)