Will this work?
#1

Will this work?

Код:
    if(playerOnline >= 2 || 4 || 6 || 8)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 0 || 1 || 2 || 3)
	   {
	       TeamBalance();
	   }
	}
Reply
#2

Why you didn't search answered of your theread with testing it? xD
Reply
#3

This:
pawn Код:
switch(playerOnline)
{
    case 2..8:
    {
        switch(GetTeamPlayersAlive(TEAM_RED))
        {
            case 0..3:
            {
                TeamBalance();
            }
        }
    }
}
Or:
pawn Код:
if(playerOnline >= 2 && playerOnline <= 8)
{
   if(GetTeamPlayersAlive(TEAM_RED) >= 0 && GetTeamPlayersAlive(TEAM_RED) <= 3)
   {
       TeamBalance();
   }
}
Will work, yours won't. You can't do this "|| 1 || 2 || 3", you have to add the full condition.
Reply
#4

And
Код:
if(playerOnline >= 2 && playerOnline <= 8)
{
   if(GetTeamPlayersAlive(TEAM_RED) >= 0 && GetTeamPlayersAlive(TEAM_RED) <= 3)
   {
       TeamBalance();
   }
}
will do the same like

Код:
   if(playerOnline >= 2 || 4 || 6 || 8)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 0 || 1 || 2 || 3)
	   {
	       TeamBalance();
	   }
	}
?
Reply
#5

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
And
Код:
if(playerOnline >= 2 && playerOnline <= 8)
{
   if(GetTeamPlayersAlive(TEAM_RED) >= 0 && GetTeamPlayersAlive(TEAM_RED) <= 3)
   {
       TeamBalance();
   }
}
will do the same like

Код:
   if(playerOnline >= 2 || 4 || 6 || 8)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 0 || 1 || 2 || 3)
	   {
	       TeamBalance();
	   }
	}
?
Yes, yes it will.
Reply
#6

Also it will for example like if there are 2 players online, it will check automatically and switch one player to TEAM_RED? Without checking if playerOnline is 4 for example?
Reply
#7

Let me translate that for you:
pawn Код:
if(playerOnline >= 2 && playerOnline <= 8)
{
   if(GetTeamPlayersAlive(TEAM_RED) >= 0 && GetTeamPlayersAlive(TEAM_RED) <= 3)
   {
       TeamBalance();
   }
}

if the variable "playerOnline" is above or equal to 2 AND if the variable "playerOnline" is below or equal to 3 => CONTINUE SEQUENCE
{
    if the condition "GetTeamPlayersAlive(TEAM_RED)" is above or equal to 0 AND if the condition "GetTeamPlayersAlive(TEAM_RED)" is below or equal to 3 => CONTINUE SEQUENCE
    {
        if all the conditions above are TRUE => PERFORM "TeamBalance();"
    }
}
It depends on what the variable "playerOnline" holds.
Reply
#8

Ok thank you but please help me if i want to do it like that, this doesn't work, can you fix it?

Код:
    if(playerOnline >= 2)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 0)
	   {
	       TeamBalance();
	   }
	}
	
    if(playerOnline >= 4)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 1)
	   {
	       TeamBalance();
	   }
	}
	
    if(playerOnline >= 6)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 2)
	   {
	       TeamBalance();
	   }
	}
	
    if(playerOnline >= 8)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 3)
	   {
	       TeamBalance();
	   }
	}
Reply
#9

Quote:
Originally Posted by Blackazur
Посмотреть сообщение
Ok thank you but please help me if i want to do it like that, this doesn't work, can you fix it?

Код:
    if(playerOnline >= 2)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 0)
	   {
	       TeamBalance();
	   }
	}
	
    if(playerOnline >= 4)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 1)
	   {
	       TeamBalance();
	   }
	}
	
    if(playerOnline >= 6)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 2)
	   {
	       TeamBalance();
	   }
	}
	
    if(playerOnline >= 8)
	{
	   if(GetTeamPlayersAlive(TEAM_RED) == 3)
	   {
	       TeamBalance();
	   }
	}
pawn Код:
if(playerOnline >= 2 && GetTeamPlayersAlive(TEAM_RED) == 0) TeamBalance();
else if(playerOnline >= 4 && GetTeamPlayersAlive(TEAM_RED) == 1) TeamBalance();
else if(playerOnline >= 6 && GetTeamPlayersAlive(TEAM_RED) == 2) TeamBalance();
else if(playerOnline >= 8 && GetTeamPlayersAlive(TEAM_RED) == 3) TeamBalance();
Reply
#10

This doesn't work it just checks the first line of it, can you fix it?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)