SA-MP Forums Archive
[Ajuda] Nгo ta, pq ? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: Non-English (https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Ajuda] Nгo ta, pq ? (/showthread.php?tid=463763)



Nгo ta, pq ? - VeNuZ_ - 13.09.2013

pawn Код:
forward MudarArena(playerid);
public MudarArena(playerid)
{
     for(new i; i < MAX_PLAYERS; i++)
     {
        new passar;
        if(passar[playerid] == 0) // Primeira Arena
        {
                rand = random(sizeof(SpawnA1));
                SetPlayerPos(playerid, SpawnA1[rand][0], SpawnA1[rand][1], SpawnA1[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA1[rand][3]);
                QualArena = 1;
                SetTimer("MudarArena", 900000, 1);
        }
        else if(passar[playerid] == 1) // Segunda Arena
        {
                rand = random(sizeof(SpawnA2));
                SetPlayerPos(playerid, SpawnA2[rand][0], SpawnA2[rand][1], SpawnA2[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA2[rand][3]);
                QualArena = 2;
                SetTimer("MudarArena", 900000, 1);
        }
     }
     return 1;
}
escolhe sempre a arena 1 ,pq ?


Re: Nгo ta, pq ? - VeNuZ_ - 13.09.2013

Alguem ?


Re: Nгo ta, pq ? - PT - 13.09.2013

pawn Код:
// la no topo
new QualArena[MAX_PLAYERS] = 0;

forward MudarArena(playerid);
public MudarArena(playerid)
{
     for(new i; i < MAX_PLAYERS; i++)
     {
       
        if(QualArena[playerid] == 0) // Primeira Arena
        {
                rand = random(sizeof(SpawnA1));
                SetPlayerPos(playerid, SpawnA1[rand][0], SpawnA1[rand][1], SpawnA1[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA1[rand][3]);
                QualArena[playerid] = 1;
                SetTimer("MudarArena", 900000, 1);
        }
        if(QualArena[playerid] == 1) // Segunda Arena
        {
                rand = random(sizeof(SpawnA2));
                SetPlayerPos(playerid, SpawnA2[rand][0], SpawnA2[rand][1], SpawnA2[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA2[rand][3]);
                QualArena[playerid] = 0;
                SetTimer("MudarArena", 900000, 1);
        }
     }
     return 1;
}



Re: Nгo ta, pq ? - VeNuZ_ - 13.09.2013

Isso assim nгo vai calhar a mesma arena correcto? Й possнvel por as arenas aleatуrias ?


Re: Nгo ta, pq ? - PT - 13.09.2013

Quote:
Originally Posted by VeNuZ_
Посмотреть сообщение
Isso assim nгo vai calhar a mesma arena correcto? Й possнvel por as arenas aleatуrias ?
correto ira sempre ser diferente olha a variavel la :/


Re: Nгo ta, pq ? - VeNuZ_ - 13.09.2013

posso por QualArena = 0,1;
se eu quiser adicionar outra arena?

Como meto as arenas aleatуrias ? posso usar o Random ?


Re: Nгo ta, pq ? - PT - 13.09.2013

pawn Код:
forward MudarArena(playerid);
public MudarArena(playerid)
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        new pt = random(2); // 2 numero de arenas
        switch(pt)
        {
            case 0:
            {
                rand = random(sizeof(SpawnA1));
                SetPlayerPos(playerid, SpawnA1[rand][0], SpawnA1[rand][1], SpawnA1[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA1[rand][3]);
                SetTimer("MudarArena", 900000, 1);
            }
            default:
            {
                rand = random(sizeof(SpawnA2));
                SetPlayerPos(playerid, SpawnA2[rand][0], SpawnA2[rand][1], SpawnA2[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA2[rand][3]);
                SetTimer("MudarArena", 900000, 1);
            }
        }
    }
    return 1;
}



Re: Nгo ta, pq ? - VeNuZ_ - 13.09.2013

default ponho case 1: depois noutra arena que eu adicione, case 2: etc certo ?


Re: Nгo ta, pq ? - PT - 13.09.2013

Quote:
Originally Posted by VeNuZ_
Посмотреть сообщение
default ponho case 1: depois noutra arena que eu adicione, case 2: etc certo ?
default fica no fim rs

pawn Код:
forward MudarArena(playerid);
public MudarArena(playerid)
{
    for(new i; i < MAX_PLAYERS; i++)
    {
        new pt = random(2); // 2 numero de arenas
        switch(pt)
        {
            case 0:
            {
                rand = random(sizeof(SpawnA1));
                SetPlayerPos(playerid, SpawnA1[rand][0], SpawnA1[rand][1], SpawnA1[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA1[rand][3]);
                SetTimer("MudarArena", 900000, 1);
            }
            case 1:
            case 2:
            ....
            default:
            {
                rand = random(sizeof(SpawnA2));
                SetPlayerPos(playerid, SpawnA2[rand][0], SpawnA2[rand][1], SpawnA2[rand][2]);
                GetPlayerFacingAngle(playerid, SpawnA2[rand][3]);
                SetTimer("MudarArena", 900000, 1);
            }
        }
    }
    return 1;
}
nao esqueзe de mudar o numero de arena la em cima


Re: Nгo ta, pq ? - VeNuZ_ - 13.09.2013

Me jб percebi, Obrigado. +REP (se der pa dar xD).