SA-MP Forums Archive
750 Vehicle Health to %? - 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: 750 Vehicle Health to %? (/showthread.php?tid=412550)



750 Vehicle Health to %? - Admigo - 02.02.2013

Hi all,

A vehicle have 1000 health.
The vehicle explode on 250 health.
How can i change the health to %?
So like when my vehicle has 375 health the vehicle is 50 % damaged.

Admigo


Re: 750 Vehicle Health to %? - Vince - 02.02.2013

pawn Код:
new
    Float:health,
    Float:percent;

GetVehicleHealth(vehicleid, health);
percent = (((health - 250.0) / (1000.0 - 250.0)) * 100.0);



Re: 750 Vehicle Health to %? - Admigo - 02.02.2013

Quote:
Originally Posted by Vince
Посмотреть сообщение
pawn Код:
new
    Float:health,
    Float:percent;

GetVehicleHealth(vehicleid, health);
percent = (((health - 250.0) / (1000.0 - 250.0)) * 100.0);
Omg, I feel dumb that i didnt know this. Thanks Rep +.