Problem with GetVehicleHealth
#1

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

> means greater while < means smaller.

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

omg i am sleeping while scripting Thanks
Reply
#4

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.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)