percentage - 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: percentage (
/showthread.php?tid=302910)
percentage -
gagnier91 - 11.12.2011
im trying to do a simple percentage of damage a vehicle have, but it always return 0% when no damage (correct), but at the moment it get a damage, it return 100%, and when it take in fire it return 200%.
This is what i've tryied :
pawn Код:
GetVehicleHealth(vehicleid, domm);
domm1 = floatround(100 - 100*((domm/10)-25)/75));
Re: percentage -
MP2 - 11.12.2011
To work out a percentage:
(value/100)*25
That will give you 25% of something.
Re : percentage -
gagnier91 - 11.12.2011
look, a car default health is 1000, so i put it in percentage by dividing it by ten, then i remove the 25 where the car catch in fire, this will get me 75 when its full, so for a percentage it would be : (health/75)*100. then, i want it to be reversed, so i do 100-(health/75)*100, it work in real life but when i run that in the game it return 0, 100 or 200 %...
Re: percentage -
MP2 - 11.12.2011
(1000/100)*damage
Re : percentage -
gagnier91 - 11.12.2011
why the hell would i do damage*10 ?