17.06.2015, 19:50
Try this:
GetVehicleHealth returns a number from 0 to 1000 as a float. To get it as a percentage, so between 0 and 100, you would need to divide it by 10.
You were also displaying it as an integer (%d), when it should be a float (%f). In the code above, I used %.0f to hide the decimal places using the .0
Hope this helped!
Код:
if(IsPlayerInAnyVehicle(playerid)) { if(!VoziloJeBicikla(GetVehicleModel(GetPlayerVehic leID(playerid)))) { new Ostecenje[100];new Float:HP; GetVehicleHealth(GetPlayerVehicleID(playerid), HP); format(Ostecenje, sizeof(Ostecenje), "%.0f", HP/1000.0); PlayerTextDrawSetString(playerid, Speedo[14][playerid], Ostecenje); } }
You were also displaying it as an integer (%d), when it should be a float (%f). In the code above, I used %.0f to hide the decimal places using the .0
Hope this helped!