SA-MP Forums Archive
GetVehicleHealth Help - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: GetVehicleHealth Help (/showthread.php?tid=158212)



GetVehicleHealth Help - RichyB - 09.07.2010

Alright, I am trying to have it so if the Vehicle Health is 1000 the player will get a certain amount of money
Thats easy, but how do I do it so if the Vehicle health is between lets say 900 and 999? How do I find out this?

I was using
pawn Код:
if(GetVehicleHealth(vehicleid) == 1000)
{
return 1;
}
for the 100 Car Health, but how would I get it to find out if the health is between 900 and 999?


Re: GetVehicleHealth Help - Grim_ - 09.07.2010

pawn Код:
if(GetVehicleHealth(vehicleid) > 899 && GetVehicleHealth(vehicleid) < 1000)
{
   return 1;
}



Re: GetVehicleHealth Help - RichyB - 09.07.2010

Great, thankyou, excellent help.


Re: GetVehicleHealth Help - Grim_ - 09.07.2010

No problem.

Please also notice that GetVehicleHealth has a '&Float:health' argument, so your code should look something like this:
pawn Код:
new Float:vhealth;
if(GetVehicleHealth(vehicleid, vhealth) > 899 && GetVehicleHealth(vehicleid, vhealth) < 1000)
{
   return 1;
}



Re: GetVehicleHealth Help - Grim_ - 09.07.2010

I've already told him what else he needed to do.

Both mine and your code do the same exact same.


Re: GetVehicleHealth Help - Kar - 09.07.2010

[NVM] both of urs are good lol


Re: GetVehicleHealth Help - Grim_ - 09.07.2010

Ded, unless you are counting 0.00000000001s of a second, it's not more efficient.