SA-MP Forums Archive
Vehicle Break Down - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Vehicle Break Down (/showthread.php?tid=247362)



Vehicle Break Down - Tommy_Mandaz - 09.04.2011

How can I make it so that when the Vehicle Health is lower then 15 the car automatically breaks down and the person must call a mechanic? Thanks.


Re: Vehicle Break Down - Shelby - 09.04.2011

pawn Код:
if(GetVehicleHealth(GetPlayerVehicleID(playerid)) < 15)
{
    new engine,lights,alarm,doors,bonnet,boot,objective;
    GetVehicleParamsEx(GetPlayerVehicleID(playerid),engine,lights,alarm,doors,bonnet,boot,objective);
    SetVehicleParamsEx(GetPlayerVehicleID(playerid),VEHICLE_PARAMS_OFF,lights,alarm,doors,bonnet,boot,objective);
    SendClientMessage(playerid, 0xFF0080FF, "Your engine is broken");
}
You'll need a SetTimer to check vehicles's player health.

Note: When life of vehicle is lower than 300, the vehicle starts burning...