GREEN - 750 - 1000 YELLOW - 500 - 749 RED - 250 - 499 RED - Totaled (0 - 249)
forward VehicleTimer(playerid);
public VehicleTimer(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new healthstring[128];
new Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
new vehhealth = GetVehicleHealth(vehicleid, health);
if(vehhealth >= 750 && vehhealth <= 1000) format(healthstring, sizeof(healthstring), "~w~Heatlh: ~g~h~%d", vehhealth);
else if(vehhealth >= 749 && vehhealth <= 500) format(healthstring, sizeof(healthstring), "~w~Health: ~y~~h~%d", vehhealth);
else if(vehhealth >= 250 && vehhealth <= 499) format(healthstring, sizeof(healthstring), "~w~Health: ~r~~h~%d", vehhealth);
else if(vehhealth >= 0 && vehhealth <= 249) format(healthstring, sizeof(healthstring), "~w~Health: ~r~~h~TOTALED");
TextDrawSetString(HealthText[playerid], healthstring);
new speedstring[128];
new kmh = GetPlayerSpeed(playerid, true);
if(kmh >= 0 && kmh <= 80) format(speedstring, sizeof(speedstring), "~w~Speed: ~g~~h~%d ~w~KM/h.", kmh);
else if(kmh >= 81 && kmh <= 120) format(speedstring, sizeof(speedstring), "~w~Speed: ~y~~h~%d ~w~KM/h.", kmh);
else if(kmh >= 121) format(speedstring, sizeof(speedstring), "~w~Speed: ~r~~h~%d ~w~KM/h.", kmh);
TextDrawSetString(SpeedoText[playerid], speedstring);
}
return 1;
}
forward VehicleTimer(playerid);
public VehicleTimer(playerid)
{
if(IsPlayerInAnyVehicle(playerid))
{
new healthstring[128];
new Float:health;
new vehicleid = GetPlayerVehicleID(playerid);
GetVehicleHealth(vehicleid, health);
if(health >= 750 && health <= 1000) format(healthstring, sizeof(healthstring), "~w~Heatlh: ~g~h~%d", vehhealth);
else if(health >= 749 && health <= 500) format(healthstring, sizeof(healthstring), "~w~Health: ~y~~h~%d", vehhealth);
else if(health >= 250 && health <= 499) format(healthstring, sizeof(healthstring), "~w~Health: ~r~~h~%d", vehhealth);
else if(health >= 0 && health <= 249) format(healthstring, sizeof(healthstring), "~w~Health: ~r~~h~TOTALED");
TextDrawSetString(HealthText[playerid], healthstring);
new speedstring[128];
new kmh = GetPlayerSpeed(playerid, true);
if(kmh >= 0 && kmh <= 80) format(speedstring, sizeof(speedstring), "~w~Speed: ~g~~h~%d ~w~KM/h.", kmh);
else if(kmh >= 81 && kmh <= 120) format(speedstring, sizeof(speedstring), "~w~Speed: ~y~~h~%d ~w~KM/h.", kmh);
else if(kmh >= 121) format(speedstring, sizeof(speedstring), "~w~Speed: ~r~~h~%d ~w~KM/h.", kmh);
TextDrawSetString(SpeedoText[playerid], speedstring);
}
return 1;
}
change
new vehhealth = GetVehicleHealth(vehicleid, health); to GetVehicleHealth(vehicleid, health); https://sampwiki.blast.hk/wiki/GetVehicleHealth |