SA-MP Forums Archive
Vehicle Health - 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 Health (/showthread.php?tid=116960)



Vehicle Health - GforceNL - 30.12.2009

Hello,

I have a Question,
How can i make this:

A car have 50% Health and i would be automatic be Repairt to 100% health?


Re: Vehicle Health - Correlli - 30.12.2009

Example:
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
  new
      Float:vehicleHealth, vehicleID;
  vehicleID = GetPlayerVehicleID(playerid);
  GetVehicleHealth(vehicleID, vehicleHealth);
  if(vehicleHealth <= 500.0) SetVehicleHealth(vehicleID, 1000.0);
}
Note that vehicle's maximum health is 1000, this code will fix vehicle if it's health is 500.0 or below.
If you would like to repair vehicle's visual damage, then use RepairVehicle(...) function.


Re: Vehicle Health - GforceNL - 30.12.2009

Quote:
Originally Posted by Don Correlli
Example:
pawn Код:
if(IsPlayerInAnyVehicle(playerid))
{
  new
      Float:vehicleHealth, vehicleID;
  vehicleID = GetPlayerVehicleID(playerid);
  GetVehicleHealth(vehicleID, vehicleHealth);
  if(vehicleHealth <= 500.0) SetVehicleHealth(vehicleID, 1000.0);
}
Note that vehicle's maximum health is 1000, this code will fix vehicle if it's health is 500.0 or below.
If you would like to repair vehicle's visual damage, then use RepairVehicle(...) function.
ok Thanks For Your help


Re: Vehicle Health - Correlli - 30.12.2009

You're welcome.