if ((final_speed_int > 10) && (AVehicleData[vehicleid][Fuel] > 0))
AVehicleData[vehicleid][Fuel] = AVehicleData[vehicleid][Fuel] - 1;
if ((AVehicleData[vehicleid][Fuel] > 0) && (AVehicleData[vehicleid][Fuel] < 100000))
format(FuelStatus, 20, "~g~%s~r~%s", "~g~I", "~r~IIIIIIIII"); // Fuel is between 0% and 10% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 1)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 2)))
format(FuelStatus, 20, "~g~%s~r~%s", "~g~II", "~r~IIIIIIII"); // Fuel is between 10% and 20% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 2)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 3)))
format(FuelStatus, 20, "~g~%s~r~%s", "~g~III", "~r~IIIIIII"); // Fuel is between 20% and 30% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 3)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 4)))
format(FuelStatus, 20, "~g~%s~y~%s", "~g~IIII", "~r~IIIIII"); // Fuel is between 30% and 40% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 4)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 5)))
format(FuelStatus, 20, "~g~%s~y~%s", "~g~IIIII", "~r~IIIII"); // Fuel is between 40% and 50% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 5)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 6)))
format(FuelStatus, 20, "~g~%s~y~%s", "~g~IIIIII", "~r~IIII"); // Fuel is between 50% and 60% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 6)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 7)))
format(FuelStatus, 20, "~g~%s~y~%s", "~g~IIIIIII", "~r~III"); // Fuel is between 60% and 70% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 7)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 8)))
format(FuelStatus, 20, "~g~%s~y~%s", "~g~IIIIIIII", "~r~II"); // Fuel is between 70% and 80% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 8)) && (AVehicleData[vehicleid][Fuel] < ((MaxFuel / 10) * 9)))
format(FuelStatus, 20, "~g~%s~y~%s", "~g~IIIIIIIII", "~r~I"); // Fuel is between 80% and 90% full
if ((AVehicleData[vehicleid][Fuel] >= ((MaxFuel / 10) * 9)) && (AVehicleData[vehicleid][Fuel] <= MaxFuel))
format(FuelStatus, 20, "~g~%s", "~g~IIIIIIIIII"); // Fuel is between 90% and 100% full (all bars are green)
if (AVehicleData[vehicleid][Fuel] == 0)
format(FuelStatus, 20, "~r~%s", "Sua Gasolina Acabou");
format(FuelString, 50, TXT_SpeedometerFuel, FuelStatus);
TextDrawSetString(APlayerData[playerid][FuelGauge], FuelString);
new Float:Vida;// Variavel da vida
GetVehicleHealth(GetPlayerVehicleID(playerid), Vida); // getando a vida
new ss[50];
if ((Vida > 0) && (Vida < 1000))
format(ss, 50, "Lataria: ~g~I~r~IIIIIIIII", Vida);
if ((Vida >= ((1000 / 10) * 1)) && (Vida < ((1000 / 10) * 2)))
format(ss, 50, "Lataria: ~g~II~r~IIIIIIII", Vida);
if ((Vida >= ((1000 / 10) * 2)) && (Vida < ((1000 / 10) * 3)))
format(ss, 50, "Lataria: ~g~III~r~IIIIIII", Vida);
if ((Vida >= ((1000 / 10) * 3)) && (Vida < ((1000 / 10) * 4)))
format(ss, 50, "Lataria: ~g~IIII~r~IIIIII", Vida);
if ((Vida >= ((1000 / 10) * 4)) && (Vida < ((1000 / 10) * 5)))
format(ss, 50, "Lataria: ~g~IIIII~r~IIIII", Vida);
if ((Vida >= ((1000 / 10) * 5)) && (Vida < ((1000 / 10) * 6)))
format(ss, 50, "Lataria: ~g~IIIIII~r~IIII", Vida);
if ((Vida >= ((1000 / 10) * 6)) && (Vida < ((1000 / 10) * 7)))
format(ss, 50, "Lataria: ~g~IIIIIII~r~III", Vida);
if ((Vida >= ((1000 / 10) * 7)) && (Vida < ((1000 / 10) * 8)))
format(ss, 50, "Lataria: ~g~IIIIIIII~r~II", Vida);
if ((Vida >= ((1000 / 10) * 8)) && (Vida < ((1000 / 10) * 9)))
format(ss, 50, "Lataria: ~g~IIIIIIIII~r~I", Vida);
if ((Vida >= ((1000 / 10) * 9)) && (Vida <= 1000))
format(ss, 50, "Lataria: ~g~IIIIIIIIII", Vida);
if (Vida == 0)
format(ss, 50, "Lataria: ~r~IIIIIIIIII", Vida);
TextDrawSetString(APlayerData[playerid][Lataria], ss);
format(FuelStatus, 20, "~g~%s~r~%s", "~g~I", "~r~IIIIIIIII");
|
cara vc ainda estб tendo dificuldade para perceber o crash ?
pawn Код:
|
new Float:Vida, str[32], string[128];
GetVehicleHealth(GetPlayerVehicleID(playerid), Vida);
switch(floatround(Vida)){
case 251 .. 300: str="Lataria: ~g~I~r~IIIIIIIIIIIIII";
case 301 .. 350: str="Lataria: ~g~II~r~IIIIIIIIIIIII";
case 351 .. 400: str="Lataria: ~g~III~r~IIIIIIIIIIII";
case 401 .. 450: str="Lataria: ~g~IIII~r~IIIIIIIIIII";
case 451 .. 500: str="Lataria: ~g~IIIII~r~IIIIIIIIII";
case 501 .. 550: str="Lataria: ~g~IIIIII~r~IIIIIIIII";
case 551 .. 600: str="Lataria: ~g~IIIIIII~r~IIIIIIII";
case 601 .. 650: str="Lataria: ~g~IIIIIIII~r~IIIIIII";
case 651 .. 700: str="Lataria: ~g~IIIIIIIII~r~IIIIII";
case 701 .. 750: str="Lataria: ~g~IIIIIIIIII~r~IIIII";
case 751 .. 800: str="Lataria: ~g~IIIIIIIIIII~r~IIII";
case 801 .. 850: str="Lataria: ~g~IIIIIIIIIIII~r~III";
case 851 .. 900: str="Lataria: ~g~IIIIIIIIIIIII~r~II";
case 901 .. 950: str="Lataria: ~g~IIIIIIIIIIIIII~r~I";
case 951 .. 1000: str="Lataria: ~g~IIIIIIIIIIIIIII";
default: str="Lataria: ~r~IIIIIIIIIIIIIII";
}
format(string,sizeof(string),"%s",str);
GameTexTForPlayer(playerid,string,1000,3);