SA-MP Forums Archive
Vehicle Health and Fuel - 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: Vehicle Health and Fuel (/showthread.php?tid=654402)



Vehicle Health and Fuel - KamilPolska - 27.05.2018

How to make 100% hp vehicle and 100 liters of fuel. I do not want to 1000% hp vehicle and 100.0 liters of fuel.

Health: 1000%
Fuel: 100.0 L
Код:
format(predstring_p, sizeof(predstring_p), "Health: %.0f%", health_car);
format(predstring_p, sizeof(predstring_p), "Fuel: %.1f L", Fuel[vehicleid]);



Re: Vehicle Health and Fuel - Mugala - 28.05.2018

you just have to remove one 0 from code, it's simple to divide it by 10.
format(predstring_p, sizeof(predstring_p), "Health: %.0f%", health_car/10);


Re: Vehicle Health and Fuel - Pottus - 28.05.2018

Quote:
Originally Posted by Mugala
Посмотреть сообщение
you just have to remove one 0 from code, it's simple to divide it by 10.
format(predstring_p, sizeof(predstring_p), "Health: %.0f%", health_car/10);
Incorrect to an extent. A vehicle catches fire at 250HP so you might want to re-calculate so that HP percentage is measured between 250.0 hp and 1000. hp.


Re: Vehicle Health and Fuel - GTLS - 28.05.2018

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Incorrect to an extent. A vehicle catches fire at 250HP so you might want to re-calculate so that HP percentage is measured between 250.0 hp and 1000. hp.
I think what Mugala tried to say is that only for display purposes, divide by 10 could be use. Originally if health is 800, on display it will show 80.0. I think thats what the OP wants too.


Re: Vehicle Health and Fuel - Mugala - 28.05.2018

Quote:
Originally Posted by Pottus
Посмотреть сообщение
Incorrect to an extent. A vehicle catches fire at 250HP so you might want to re-calculate so that HP percentage is measured between 250.0 hp and 1000. hp.
I know, it's only visual part. (like KamilPolska asked)