GetVehicleHealth Help
#1

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?
Reply
#2

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

Great, thankyou, excellent help.
Reply
#4

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;
}
Reply
#5

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

Both mine and your code do the same exact same.
Reply
#6

[NVM] both of urs are good lol
Reply
#7

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


Forum Jump:


Users browsing this thread: 2 Guest(s)