new Player_1;
new Player_2;
if(Player_1 == 2)
SetPlayerTeam(playerid, Player_2);
else if(Player_2 == 4)
SetPlayerTeam(playerid, Player_1);
else if(Player_1 == 6)
SetPlayerTeam(playerid, Player_2);
new atual;
foreach(new i: Player)
{
++atual;
switch(atual)
{
case 1: SetPlayerTeam(i, TIME_1);
case 2: SetPlayerTeam(i, TIME_2);
case 3:
{
atual = 0;
SetPlayerTeam(i, TIME_3);
}
default:
atual = 0;
}
}
new Team1,Team2; if(Team1 == Team2){ SetPlayerTeam(playerid,TIME_1); Team1++; }else if(Team1 > Team2){ SetPlayerTeam(playerid,TIME_2); Team2++; }else if(Team1 < Team2){ SetPlayerTeam(playerid,TIME_1); Team1++; }
if(!Players_Evento || (Players_Evento >= 2 && Players_Evento & 1))
{
Time_PxZ[playerid] = 1;
}
else
{
Time_PxZ[playerid] = 2;
}
Fragmento removido do evento Policiais x Zumbis, do servidor Cidade Social RPG:
pawn Код:
|
new Players_Evento;
new Time_PxZ;
new ContarPlayers[2];
public OnGameModeInit()
{
SetTimer("x", 2000, true);
return 1;
}
forward x();
public x()
{
Players_Evento ++;
if(!Players_Evento || (Players_Evento >= 2 && Players_Evento & 1))
{
Time_PxZ = 1;
ContarPlayers[0] ++;
printf("+1 equipe 1 | %i total", ContarPlayers[0]);
}
else
{
Time_PxZ = 2;
ContarPlayers[1] ++;
printf("+1 equipe 2 | %i total", ContarPlayers[1]);
}
return 1;
}
O correto seria colocar o Players_Evento no final da callback... Se bem que nгo faz tanta diferenзa,
|
new Ir_Evento;
new Dividir_Times;
new ContarPlayers[2];
public OnGameModeInit()
{
SetTimer("x", 1000, true);
return 1;
}
forward x();
public x()
{
Ir_Evento ++;
if(Ir_Evento == 1 || Dividir_Times == 1)
{
ContarPlayers[0] ++;
Dividir_Times = 2;
printf("+1 equipe 1 | %i total", ContarPlayers[0]);
}
else if(Dividir_Times == 2)
{
ContarPlayers[1] ++;
Dividir_Times = 1;
printf("+1 equipe 2 | %i total", ContarPlayers[1]);
}
return 1;
}
CMD:evento(playerid)
{
if(Dividir_Times == 0 || Dividir_Times == 1)
return Dividir_Times = 2,
//resto do cуdigo
;
else if(Dividir_Times == 2)
return Dividir_Times = 1,
//resto do cуdigo
;
}