damage bar
#1

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);
Reply
#2

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

I don't understand you much ;/
Reply
#3

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);
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)