Vehicle Health
#1

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?
Reply
#2

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.
Reply
#3

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
Reply
#4

You're welcome.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)