Comparing the health
#1

I am creating the 11th game of my X Games Series, and the type of game is derby.

I would like to know how can i compare all the vehicle's health (The player that is occupied on) and find the result which has the highest health (stable.)

Same goes to the Player Health.
Reply
#2

PHP код:
native IsValidVehicle(vehicleid);//on top
stock IsVehicleOccupied(vid)
{
     for(new 
GetPlayerPoolSize(); >= 0i--) 
     {
          if(!
IsPlayerConnected(i)) continue;
          if(
GetPlayerVehicleID(i) == vid && GetPlayerSeat(playerid) == 0) return true;
     }
     return 
false;
}
stock Get_Vehicle_With_Highest_Health()
{
  new 
Float:vhFloat:vh2vid;
  for(new 
GetVehiclePoolSize(); >= 0i--)
  {
     if(
IsValidVehicle(i))
       if(
IsVehicleOccupied(i))
         {
              
GetVehicleHealth(ivh2);
              if(
vh2 vh) { vh vh2vid i; }
         }
  }
  return 
vid;

You can apply same method with player health.
Reply
#3

I would try it out, Thank you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)