SA-MP Forums Archive
damage bar - 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)
+--- Thread: damage bar (/showthread.php?tid=358170)



damage bar - SomebodyAndMe - 09.07.2012

Hey I am trying to create a damage bar, but what is the script for it, to change it like damage = 100% means it has full health?

Anyone, I just need the script I can put it in my textdraw later.

For people interesting:, here's my code:

pawn Код:
format(damage_string, 50, "Damage: %d", GetVehicleHealth(vehicleid, Float:Health));
        TextDrawSetString(Damage, damage_string);



Re: damage bar - Jarok - 09.07.2012

IF it's for a vehicle, you can't get vehicle health "100", It's only 1000.

I don't understand you much ;/


Re: damage bar - coole210 - 09.07.2012

You're using GetVehicleHealth wrong.

Here, I also added the 100% part:

pawn Код:
new Float:VehicleHealth;
        GetVehicleHealth(vehicleid, VehicleHealth);
        format(damage_string, 50, "Damage: %.0f%%", floatdiv(VehicleHealth, 10));
        //%.0f will show float values with 0 decimal places. %% makes the per cent sign
        TextDrawSetString(Damage, damage_string);