Quote:
Originally Posted by Fel486
Olha, pode me chamar de doido...
Mas juro, tentei. Espero que dк certo.
pawn Код:
new bool:EmCorrida[MAX_PLAYERS]; // topo new bool:finalizou[MAX_PLAYERS]; // topo new IdCorrida[MAX_PLAYERS]; // topo new vencedor[MAX_PLAYERS]; // topo
EmCorrida[playerid] = false; // OnPlayerConnect finalizou[playerid] = false; // OnPlayerConnect IdCorrida[playerid] = 0; // OnPlayerConnect
CMD:corrida(playerid, params[]) { new id, str[90]; if(sscanf(params, "i", id)) return SendClientMessage(playerid, -1,"Uso: /Corrida [id rival]");
format(str, sizeof(str),"%s quer uma corrida, aceitar?", nome[playerid]); ShowPlayerDialog(id, 9999, DIALOG_STYLE_MSGBOX, "Corrida", str, "Aceitar", "Cancelar");
IdCorrida[playerid] = (id+playerid); // ID da corrida IdCorrida[id] = (id+playerid); // ID da corrida
EmCorrida[playerid] = true; EmCorrida[id] = true; finalizou[playerid] = false; finalizou[id] = false;
SetPlayerCheckPoint(playerid, x, y, z, 20); // exemplo SetPlayerCheckPoint(id, x, y, z, 20); // exemplo player2[id] = playerid; return 1; }
public OnPlayerEnterCheckpoint(playerid) { for(new a = 0; a < MAX_PLAYERS; a++) { for(new b = 1; b < MAX_PLAYERS; b++) { if(IsPlayerConnected(a) && IsPlayerConnected(b)) { if(IdCorrida[a] != 0 && IdCorrida[b] != 0) { if(IdCorrida[a] == IdCorrida[b]) { if(EmCorrida[a] == true && finalizou[a] == false) { DisablePlayerCheckPoint(b); EmCorrida[a] = false; finalizou[a] = true; vencedor[a] = 1; // venceu } else if (EmCorrida[b] == true && finalizou[b] == false) { DisablePlayerCheckPoint(b); finalizou[b] = true; EmCorrida[b] = false; vencedor[b] = 1; // venceu } } } } } return 1; }
|
Obrigado, pela lуgica ajudou bastante... Porйm, se possнvel, poderia me explicar o uso da seguinte funзгo? Estou em dъvida pois ela foi utilizada duas vezes com valores diferentes ( a | b ).
PHP код:
for(new a = 0; a < MAX_PLAYERS; a++)
{
for(new b = 1; b < MAX_PLAYERS; b++)