SA-MP Forums Archive
Problem with GetVehicleHealth - 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: Problem with GetVehicleHealth (/showthread.php?tid=490872)



Problem with GetVehicleHealth - barts - 28.01.2014

I added this to my CMD:
PHP код:
    new Float:health;
    new 
veh GetPlayerVehicleID(playerid);
    
GetVehicleHealth(vehhealth);
    if(
health >= 650) return SendClientMessage(playeridCOLOR_RED"This vehicle is too damaged!"); 
And everytime i type the CMD it retunrs "This vehicle is too damaged!".When my car has full HP it returns too.Why is that ?


Re: Problem with GetVehicleHealth - Konstantinos - 28.01.2014

> means greater while < means smaller.

pawn Код:
if(health <= 650)



Re: Problem with GetVehicleHealth - barts - 28.01.2014

omg i am sleeping while scripting Thanks


Re: Problem with GetVehicleHealth - jakejohnsonusa - 28.01.2014

You have your sign backwards. Remember in math class when your teacher told you that the 'shark always eats the bigger number because it has more meat' ... that applies here too.

What you have above says that if the health is greater than or equal to 650/1000 it will give that message.

This is what you want:
pawn Код:
if(health <= 650)

EDIT: Dang, he beat me to the answer.