SA-MP Forums Archive
[AJUDA] Comando dentro de interiores. - 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] Comando dentro de interiores. (/showthread.php?tid=306942)



[AJUDA] Comando dentro de interiores. - Guilherme P. - 28.12.2011

Estou fazendo um comando que й para funcionar apenas dentro da delegacia de Los Santos. O cуdigo й:

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/procurar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,10.0,246.783996,63.900199,1003.640625))
        {
            GetPlayerInterior(playerid)
            new rand2 = random(sizeof(RandomGuns));
            new rand3 = random(sizeof(RandomAmmo));
        GivePlayerWeapon(playerid,RandomGuns[rand2][0],RandomAmmo[rand3][0]);
            ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
        }
        else
        {
            SendClientMessage(playerid,VERMELHO,"{!} Vocк nгo pode procurar aqui.");
        }
    }
    return 1;
}
Mas quando eu digito o comando dentro da delegacia ele nгo funciona. O que hб de errado?


Re: [AJUDA] Comando dentro de interiores. - Lуs - 28.12.2011

pawn Код:
if(GetPlayerInterior(playerid) != IDINTERIORDELEGACIA) return SendClientMessage(playerid, -1, "Vocк sу pode usar esse comando dentro da delegacia.");



Re: [AJUDA] Comando dentro de interiores. - Guilherme P. - 28.12.2011

Obrigado cara, deu certo!

E para colocar um tempo entre cada comando? Tipo, digita o comando mas sу pode usa-lo de novo apуs 10 segundos, como seria feito?


Re: [AJUDA] Comando dentro de interiores. - Hardware - 28.12.2011

Sу esqueci de colocar pra checar o interior, mas isso tu coloca depois.
pawn Код:
new JaUsou[MAX_PLAYERS];
    if (strcmp("/procurar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,10.0,246.783996,63.900199,1003.640625))
        {
            if(JaUsou == 1) return SendClientMessage(playerid,-1,"O comando foi usado recentemente!");
            {
                GetPlayerInterior(playerid)
                new rand2 = random(sizeof(RandomGuns));
                new rand3 = random(sizeof(RandomAmmo));
                GivePlayerWeapon(playerid,RandomGuns[rand2][0],RandomAmmo[rand3][0]);
                ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
                JaUsou = 1;
                SetTimer("LiberarComando",10 * 1000,true);
        }
        else
        {
            SendClientMessage(playerid,VERMELHO,"{!} Vocк nгo pode procurar aqui.");
        }
    }
    forward LiberarComando();
    public LiberarComando()
    {
        JaUsou = 0;
        return 1;
    }



Re: [AJUDA] Comando dentro de interiores. - Lуs - 28.12.2011

Quote:
Originally Posted by Hardware
Посмотреть сообщение
Sу esqueci de colocar pra checar o interior, mas isso tu coloca depois.
pawn Код:
new JaUsou[MAX_PLAYERS];
    if (strcmp("/procurar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,10.0,246.783996,63.900199,1003.640625))
        {
            if(JaUsou[playerid]) return SendClientMessage(playerid,-1,"O comando foi usado recentemente!");
            {
                new rand2 = random(sizeof(RandomGuns));
                new rand3 = random(sizeof(RandomAmmo));
                GivePlayerWeapon(playerid,RandomGuns[rand2][0],RandomAmmo[rand3][0]);
                ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
                JaUsou = 1;
                SetTimerEx("LiberarComando",10 * 1000,true);
        }
        else
        {
            SendClientMessage(playerid,VERMELHO,"{!} Vocк nгo pode procurar aqui.");
        }
    }
    forward LiberarComando();
    public LiberarComando()
    {
        JaUsou = 0;
        return 1;
    }
Errou, vocк precisa de colocar o paramкtro nas variбveis e precisa usar settimerex. Fora que o seu settimer nгo irб parar de contar.

Correto:

pawn Код:
//Topo
new bool:JaUsou[MAX_PLAYERS];

//Comando
    if (strcmp("/procurar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,10.0,246.783996,63.900199,1003.640625))
        {
            if(GetPlayerInterior(playerid) != INTERIOR DELEGACIA) return SendClientMessage(playerid,-1,"Vocк sу pode usar esse comando na delegacia!");
            if(JaUsou[playerid]) return SendClientMessage(playerid,-1,"O comando foi usado recentemente!");
            new rand2 = random(sizeof(RandomGuns));
            new rand3 = random(sizeof(RandomAmmo));
            GivePlayerWeapon(playerid,RandomGuns[rand2][0],RandomAmmo[rand3][0]);
            ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
            JaUsou[playerid] = true;
            SetTimer("LiberarComando", MILISEGUNDOS, false, "i", playerid);
        }
        else
        {
            SendClientMessage(playerid,VERMELHO,"{!} Vocк nгo pode procurar aqui.");
        }
    }

//public
forward LiberarComando(playerid);
public LiberarComando(playerid)
{
    JaUsou[playerid] = false;
    return 1;
}
Malz hard, mais nгo foi dessa vez.


Re: [AJUDA] Comando dentro de interiores. - Hardware - 28.12.2011

Puts, й verdade. Valeu aн. Sу que tem um porйm, tu falou pra mim usar SetTimerEx, sу que tu digitou SetTimer.UEHEUEHUEH


Re: [AJUDA] Comando dentro de interiores. - Lуs - 28.12.2011

UEHEUHEUHEUHUEU. Й mesmo, nem vi.

Eu to programando no Quick Reply |:


Re: [AJUDA] Comando dentro de interiores. - Guilherme P. - 09.01.2012

Trazendo este tуpico de volta, para colocar mais interiores dentro deste mesmo cуdigo como eu faзo?

pawn Код:
public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/procurar", cmdtext, true, 10) == 0)
    {
        if(IsPlayerInRangeOfPoint(playerid,100.0,246.783996,63.900199,1003.640625))
        {
            if(GetPlayerInterior(playerid) != 6)
            if(JaUsou[playerid]) return SendClientMessage(playerid,VERMELHO,"-> Espere um tempo para procurar novamente!");
            JaUsou[playerid] = true;
            SetTimerEx("LiberarProcurar", 10000, false, "i", playerid);
            new rand2 = random(sizeof(RandomGuns));
            new rand3 = random(sizeof(RandomAmmo));
            ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
            new string[128];
            GivePlayerWeapon(playerid,RandomGuns[rand2][0],RandomAmmo[rand3][0]);
            format(string,sizeof(string),"> %s encontrou uma arma.",Nome(playerid));
            SendClientMessageToAll(AZUL,string);
        }
        else
        {
            SendClientMessage(playerid,VERMELHO,"-> Vocк nгo pode procurar aqui.");
        }
    }
    return 1;
}
Tipo, aн sу estб na delegacia, mas digamos que eu quero que dentro da 24/7 esse mesmo comando dк certo.
Como eu deveria fazer?


Re: [AJUDA] Comando dentro de interiores. - Hardware - 09.01.2012

pawn Код:
if (strcmp("/procurar", cmdtext, true, 10) == 0)
{
    if(IsPlayerInRangeOfPoint(playerid,100.0,246.783996,63.900199,1003.640625))
    {
        if((GetPlayerInterior(playerid) != 6) || (GetPlayerInterior(playerid) != COORDE) || (GetPlayerInterior(playerid) != CORDE))
        if(JaUsou[playerid]) return SendClientMessage(playerid,VERMELHO,"-> Espere um tempo para procurar novamente!");
        JaUsou[playerid] = true;
        SetTimerEx("LiberarProcurar", 10000, false, "i", playerid);
        new rand2 = random(sizeof(RandomGuns));
        new rand3 = random(sizeof(RandomAmmo));
        ApplyAnimation(playerid, "BOMBER","BOM_Plant_In",4.0,0,0,0,0,0);
        new string[128];
        GivePlayerWeapon(playerid,RandomGuns[rand2][0],RandomAmmo[rand3][0]);
        format(string,sizeof(string),"> %s encontrou uma arma.",Nome(playerid));
        SendClientMessageToAll(AZUL,string);
    }
    else
    {
        SendClientMessage(playerid,VERMELHO,"-> Vocк nгo pode procurar aqui.");
    }
}
Aquelas duas barrinhas, sгo um operador lуgico. Sendo assim, || й mesma coisa que OU.

@off
Ah, tu estб jogando muito no servidor Project Apocalypse. UEHUHEHUHEUHE


Re: [AJUDA] Comando dentro de interiores. - Guilherme P. - 09.01.2012

O "IsPlayerInRangeOfPoint" tem que mudar alguma coisa?


Quote:

@off
Ah, tu estб jogando muito no servidor Project Apocalypse. UEHUHEHUHEUHE

Й, jogando muito! Sou level 6 jб.
Estou me inspirando nele pra fazer um GM do zero. Sу que a diferenзa й que os zumbis serгo bots.

Sу estou fazendo pra ampliar meu conhecimento em pawn e pra ficar zoando com meus amigos! =]