Check wich vehicle has the most health
#3

Just a little example how to do it:
pawn Код:
//somewhere
new Float:max = 0.00;
new winner = -1;
for(new i = 0; i < GetMaxPlayers(); i++)
{
  if(IsPlayerConnected(i))
  {
    if(PlayerInDerby[i] == 1)//or whatever you use to know that this player is in derby
    {
      if(IsPlayerInAnyVehicle(i))
      {
        new Float:h;
        GetVehicleHealth(GetPlayerVehicleID(i),h);
        if(h > max)
        {
          max = h;
          winner = i;
         }
       }
     
    }
  }
}
if(winner != -1)
{
  new name[MAX_PLAYER_NAME], string[80];
  GetPlayerName(winner,name,sizeof(name));
  format(string,sizeof(string),"%s's vehicle has the most health and won this round",name);
  SendClientMessageToAll(COLOR_WHITE,string);//or whatever color you need
}
Reply


Messages In This Thread
Check wich vehicle has the most health - by juuleman - 07.05.2010, 12:47
Re: Check wich vehicle has the most health - by juuleman - 07.05.2010, 13:43
Re: Check wich vehicle has the most health - by Norck - 07.05.2010, 13:58
Re: Check wich vehicle has the most health - by juuleman - 07.05.2010, 14:05

Forum Jump:


Users browsing this thread: 1 Guest(s)