SetPlayerTeam
#1

Is it possible to use something like,

Код:
if (playerid == 0 || playerid == 2 || playerid == 4|| playerid == 6 || playerid == 8 (and so on to 50) )
        {
            SetPlayerTeam (playerid, 1);
        }
if (playerid == 1 || playerid == 3 || playerid == 5|| playerid == 7 || playerid == 9 (and so on to 50) )
        {
            SetPlayerTeam (playerid, 2);
        }
to set the players team by using their id? I want this so that each team will always have close to equal numbers...
Reply
#2

no because it would give an error saying line to long, why use that when u can use auto setteaM?
if player below playerid 50 then set team to 1 simple...
Reply
#3

pawn Код:
for(new i = 0 ; i < MAX_PLAYERS; i ++ )
{
     if( IsPlayerConnected( i ) )
     {
         if( i % 2 == 0 ) // Number is not odd == it is EVEN AND % operator returns remainder.
         {
               SetPlayerTeam( i , 1 );
               continue;
         }
         else SetPlayerTeam( i , 2 );
     }
}
Reply
#4

Quote:
Originally Posted by Rajat_Pawar
Посмотреть сообщение
pawn Код:
for(new i = 0 ; i < MAX_PLAYERS; i ++ )
{
     if( IsPlayerConnected( i ) )
     {
         if( i % 2 == 0 ) // Number is not odd == it is EVEN AND % operator returns remainder.
         {
               SetPlayerTeam( i , 1 );
               continue;
         }
         else SetPlayerTeam( i , 2 );
     }
}
Nice, but where would this go? And it would check all id's? All even numbers to infinity?
Reply
#5

Quote:
Originally Posted by cray1100
Посмотреть сообщение
Nice, but where would this go? And it would check all id's? All even numbers to infinity?
You put it at OnPlayerRequestClass and yes it will work for all the ID's.

actually use just this OnPlayerRequestClass
pawn Код:
if( playerid % 2 == 0 ) // Number is not odd == it is EVEN AND % operator returns remainder.
         {
               SetPlayerTeam( playerid , 1 );
         }
         else SetPlayerTeam( playerid , 2 );
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)