SetPlayerTeam - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: SetPlayerTeam (
/showthread.php?tid=456249)
SetPlayerTeam -
cray1100 - 05.08.2013
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...
Re: SetPlayerTeam -
SwisherSweet - 05.08.2013
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...
Re: SetPlayerTeam -
RajatPawar - 05.08.2013
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 );
}
}
Re: SetPlayerTeam -
cray1100 - 05.08.2013
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?
Re: SetPlayerTeam -
Edix - 05.08.2013
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 );