[HELP]GetVehicleHealth
#1

Right now I am trying to make a speedometer which shows health, speed and the name of the vehicle. So far I am working on health and I'm trying to make it so each color corresponds to the health of the car.
Код:
GREEN - 750 - 1000
YELLOW - 500 - 749
RED - 250 - 499
RED - Totaled (0 - 249)
What's happening is, instead of the vehicle health showing with it's color it's showing only TOTALED. Does anybody have an idea of what I am doing wrong. Here's the code...
pawn Код:
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;
}
Reply


Messages In This Thread
[HELP]GetVehicleHealth - by PCheriyan007 - 13.07.2011, 02:50
Re: [HELP]GetVehicleHealth - by PrawkC - 13.07.2011, 02:57
Re: [HELP]GetVehicleHealth - by Shadoww5 - 13.07.2011, 02:59
Re: [HELP]GetVehicleHealth - by Daren_Jacobson - 13.07.2011, 03:03

Forum Jump:


Users browsing this thread: 1 Guest(s)