SA-MP Forums Archive
SetVehicleHealth - 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: SetVehicleHealth (/showthread.php?tid=600904)



SetVehicleHealth (+REP) ITS QUICK PPL - Lirbo - 14.02.2016

1000 health = 100 Health precents
10000 health = 1300 Health precents... wtf?
how can i set 1000 health precents then?


Re: SetVehicleHealth - Lirbo - 14.02.2016

bump cmon it's a silly question pls help me for 1 sec and get ur rep


Re: SetVehicleHealth - Joron - 14.02.2016

What? 100% for what?


Re: SetVehicleHealth - AmigaBlizzard - 14.02.2016

Show some code where it calculates that weird percent value.

10000 health should be 1000 percent.

How did you get 1300 percent?
There is no native function to check health in percent.


Re: SetVehicleHealth - iKarim - 15.02.2016

PHP код:
Float:CalculatePercent(Float:valueFloat:maxvalue) {
    return ( (
value maxvalue ) * 100.0 );

Test:
PHP код:
    printf("Value: %0.1f, Max: %0.1f, percent: %0.1f%%"900.01000.0CalculatePercent(900.01000.0));
    
printf("Value: %0.1f, Max: %0.1f, percent: %0.1f%%"9000.01000.0CalculatePercent(9000.01000.0));
    
printf("Value: %0.1f, Max: %0.1f, percent: %0.1f%%"1000.01000.0CalculatePercent(1000.01000.0));
    
printf("Value: %0.1f, Max: %0.1f, percent: %0.1f%%"10000.01000.0CalculatePercent(10000.01000.0));
    
printf("Value: %0.1f, Max: %0.1f, percent: %0.1f%%"845.01000.0CalculatePercent(845.01000.0)); 
Results:
PHP код:
[07:13:38Value900.0Max1000.0percent90.0%
[
07:13:38Value9000.0Max1000.0percent900.0%
[
07:13:38Value1000.0Max1000.0percent100.0%
[
07:13:38Value10000.0Max1000.0percent1000.0%
[
07:13:38Value845.0Max1000.0percent84.5



Re: SetVehicleHealth - Nero_3D - 15.02.2016

Set the vehicle health to 7750 for 1000 Health Percent

PHP код:
#define CalcPercentVehicleHealth(%0) (((%0) * 75) / 10 + 250)