[AJUDA] Comando dentro de interiores.
#1

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?
Reply
#2

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

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?
Reply
#4

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;
    }
Reply
#5

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.
Reply
#6

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

UEHEUHEUHEUHUEU. Й mesmo, nem vi.

Eu to programando no Quick Reply |:
Reply
#8

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?
Reply
#9

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
Reply
#10

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! =]
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)