[Ajuda] Dъvida em questгo de posiзгo.
#4

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 0MAX_PLAYERSa++)
    {
        for(new 
1MAX_PLAYERSb++) 
Reply


Messages In This Thread
Dъvida em questгo de posiзгo. - by Ley - 23.04.2014, 01:12
Re: Dъvida em questгo de posiзгo. - by lKoDlFuLLaNNo - 23.04.2014, 01:39
Re: Dъvida em questгo de posiзгo. - by Fel486 - 23.04.2014, 01:42
Re: Dъvida em questгo de posiзгo. - by Ley - 23.04.2014, 02:21
Re: Dъvida em questгo de posiзгo. - by Fel486 - 23.04.2014, 02:27
Re: Dъvida em questгo de posiзгo. - by Ley - 23.04.2014, 02:44
Re: Dъvida em questгo de posiзгo. - by Fel486 - 23.04.2014, 03:29
Re: Dъvida em questгo de posiзгo. - by Ley - 23.04.2014, 03:40
Re: Dъvida em questгo de posiзгo. - by Fel486 - 23.04.2014, 03:44
Re: Dъvida em questгo de posiзгo. - by Ley - 23.04.2014, 03:51

Forum Jump:


Users browsing this thread: 3 Guest(s)