[Ajuda] Dialogo
#1

Bom criei um comando pros terroristas pegar pacotes no territorio deles deu certo, mas quando eles clicka no dialogo pra trocar os pacotes em materiais aparece o dialogo pra eles pegar pacotes novamente envez de trocar nos materiais, codigo abaixo.

pawn Код:
#define mats1 11456

    if(strcmp(cmd, "/pegarmateriaiss", true) == 0)
    {
        if (PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15)
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao e um Terrorista!");
            return 1;
        }
        if(!PlayerToPoint(3.0 ,playerid,-718.4974,-1938.5918,8.3739))
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao esta na Floresta!");
            return 1;
        }
        ShowPlayerDialog(playerid, mats1, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais que deseja pegar", "Pegar", "Cancelar");
        return 1;
    }
    if(strcmp(cmd, "/trocarmateriaiss", true) == 0)
    {
        if (PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15)
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao e um Terrorista!");
            return 1;
        }
        if(!PlayerToPoint(3.0 ,playerid,-718.4974,-1938.5918,8.3739))
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao esta no Floresta!");
            return 1;
        }
        if(MatsHolding[playerid] > 0)
        {
            SendClientMessage(playerid, Cinza3D, "Vocк nгo tem nenhum pacote!");
            return 1;
        }
        new payout = (100)*(MatsHolding[playerid]);
        format(string, sizeof(string), "*A Boca Comprou [%d] de Materiais e te deu [%d] Materiais.", MatsHolding[playerid],payout);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        PlayerInfo[playerid][pMats] += payout;
        MatsHolding[playerid] = 0;
        return 1;
    }

    if(strcmp(cmd, "/trr1d3", true) == 0)
    {
        if (PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15)
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao e um Terrorista!");
            return 1;
        }
        if(!PlayerToPoint(3.0 ,playerid,-718.4974,-1938.5918,8.3739))
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao esta na Floresta!");
            return 1;
        }
        TogglePlayerControllable(playerid, 0);
        ShowPlayerDialog(playerid,mats1,DIALOG_STYLE_LIST,"Menu De Materiais","Pegar Materias\nTrocar Materias","Confirmar","Cancelar");
        return 1;
    }

    if(dialogid == mats1)
    {
        if(response == 0)
        {
             return 1;
        }
        if(response == 1)
        {
            if(listitem == 0)
            {
                OnPlayerCommandText(playerid,"/pegarmateriaiss");
                return 1;
            }
            if(listitem == 1)
            {
                OnPlayerCommandText(playerid,"/trocarmateriaiss");
            }
        }
        return 1;
}


if(dialogid == mats1)
    {
        if(response == 0)
        {
             return true;
        }
        if(!response) { return ShowPlayerDialog(playerid, mats1, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais que deseja pegar", "Pegar", "Cancelar"); }
        else if(!IsNumero(inputtext))
        {
            ShowPlayerDialog(playerid, mats1, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais/nque deseja pegar", "Pegar", "Cancelar");
            SendClientMessage(playerid,COLOR_GREY,"Porfavor, use nъmeros!");
            return 1;
        }
        new ammount = strval(inputtext);
        if(MatsHolding[playerid] >= 70)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Vocк jб tem pacotes !");
            return 1;
        }
        if(ammount < 1 || ammount > 70) { SendClientMessage(playerid, COLOR_GREY, "   Nъmero de pacotes mнnimo 1 mбximo 70 !"); return 1; }
        new price = ammount * 100;
        if(GetPlayerMoney(playerid) > price)
        {
            format(string, sizeof(string), "* Vocк recebeu %d Pacotes por R$%d.", ammount, price);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            GivePlayerMoney(playerid, - price);
            SBizzInfo[16][sbTill] += price;
            ExtortionSBiz(16, price);
            MatsHolding[playerid] = ammount;
        }
        else
        {
            format(gstring, sizeof(gstring), "   Vocк nгo tem R$%d !", price);
            SendClientMessage(playerid, COLOR_GREY, gstring);
        }
    }
Reply
#2

Tem dois dialogs com o mesmo ID.
Nгo deixe-os com o mesmo ID.
ID de Dialog й em nъmeros, mas vocк pode usar palavras se vocк fizer uma enum. (O que й mais recomendбvel do que #define segundo a wiki)

pawn Код:
enum
{
    DIALOG_PEGARMATS,
    DIALOG_TROCARMATS
}
Agora que jб temos os ID's do dialogo vamos arruma-los conforme os seus dialogs:

Dialog de pegar:

pawn Код:
ShowPlayerDialog(playerid,DIALOG_PEGARMATS, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais que deseja pegar", "Pegar", "Cancelar");
Dialog de trocar:

pawn Код:
ShowPlayerDialog(playerid,mats1,DIALOG_TROCARMATS,"Menu De Materiais","Pegar Materias\nTrocar Materias","Confirmar","Cancelar");
Seu code corrigido ficaria assim:

pawn Код:
enum
{
    DIALOG_PEGARMATS,
    DIALOG_TROCARMATS
}

// Em OnPlayerCommandText

    if(strcmp(cmd,"/pegarmateriaiss",true) == 0)
    {
        if (PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15)
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao e um Terrorista!");
            return 1;
        }
        if(!PlayerToPoint(3.0 ,playerid,-718.4974,-1938.5918,8.3739))
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao esta na Floresta!");
            return 1;
        }
        ShowPlayerDialog(playerid,DIALOG_PEGARMATS, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais que deseja pegar", "Pegar", "Cancelar");
        return 1;
    }
    if(strcmp(cmd, "/trocarmateriaiss", true) == 0)
    {
        if (PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15)
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao e um Terrorista!");
            return 1;
        }
        if(!PlayerToPoint(3.0 ,playerid,-718.4974,-1938.5918,8.3739))
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao esta no Floresta!");
            return 1;
        }
        if(MatsHolding[playerid] > 0) // Eu nгo sei se ta funcionando aн, mas o certo nгo seria == 0 ?
        {
            SendClientMessage(playerid, Cinza3D, "Vocк nгo tem nenhum pacote!");
            return 1;
        }
        new payout = (100)*(MatsHolding[playerid]);
        format(string, sizeof(string), "*A Boca Comprou [%d] de Materiais e te deu [%d] Materiais.", MatsHolding[playerid],payout);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        PlayerInfo[playerid][pMats] += payout;
        MatsHolding[playerid] = 0;
        return 1;
    }

    if(strcmp(cmd, "/trr1d3", true) == 0)
    {
        if (PlayerInfo[playerid][pMembro] != 6 && PlayerInfo[playerid][pLider] != 6 && PlayerInfo[playerid][pMembro] != 15 && PlayerInfo[playerid][pLider] != 15)
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao e um Terrorista!");
            return 1;
        }
        if(!PlayerToPoint(3.0 ,playerid,-718.4974,-1938.5918,8.3739))
        {
            SendClientMessage(playerid, Cinza3D, "Voce nao esta na Floresta!");
            return 1;
        }
        TogglePlayerControllable(playerid, 0);
        ShowPlayerDialog(playerid,DIALOG_TROCARMATS,DIALOG_STYLE_LIST,"Menu De Materiais","Pegar Materias\nTrocar Materias","Confirmar","Cancelar");
        return 1;
    }
   
// Em OnDialogResponse

    if(dialogid == DIALOG_TROCARMATS)
    {
        if(response == 0)
        {
             return 1;
        }
        if(response == 1)
        {
            if(listitem == 0)
            {
                OnPlayerCommandText(playerid,"/pegarmateriaiss");
                return 1;
            }
            if(listitem == 1)
            {
                OnPlayerCommandText(playerid,"/trocarmateriaiss");
            }
        }
    }
    return 1;
}
    if(dialogid == DIALOG_PEGARMATS)
    {
        if(response == 0)
        {
             return true;
        }
        if(!response) { return ShowPlayerDialog(playerid, DIALOG_PEGARMATS, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais que deseja pegar", "Pegar", "Cancelar"); }
        else if(!IsNumero(inputtext))
        {
            ShowPlayerDialog(playerid, DIALOG_PEGARMATS, DIALOG_STYLE_INPUT, "Pegar Materiais", "Digite a quantidade de materiais/nque deseja pegar", "Pegar", "Cancelar");
            SendClientMessage(playerid,COLOR_GREY,"Porfavor, use nъmeros!");
            return 1;
        }
        new ammount = strval(inputtext);
        if(MatsHolding[playerid] >= 70)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Vocк jб tem pacotes !");
            return 1;
        }
        if(ammount < 1 || ammount > 70) { SendClientMessage(playerid, COLOR_GREY, "   Nъmero de pacotes mнnimo 1 mбximo 70 !"); return 1; }
        new price = ammount * 100;
        if(GetPlayerMoney(playerid) > price)
        {
            format(string, sizeof(string), "* Vocк recebeu %d Pacotes por R$%d.", ammount, price);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            GivePlayerMoney(playerid, - price);
            SBizzInfo[16][sbTill] += price;
            ExtortionSBiz(16, price);
            MatsHolding[playerid] = ammount;
        }
        else
        {
            format(gstring, sizeof(gstring), "   Vocк nгo tem R$%d !", price);
            SendClientMessage(playerid, COLOR_GREY, gstring);
        }
        return 1;
    }
Digamos que vocк tem dois cachorros. O dois se chamam BOB. Vocк grita: BOB Vem cб!
No caso virб os dois, e o que chegar primeiro vai ser o escolhido, mas nгo necessariamente o que vocк quer.

Espero que vocк tenha entendido e que eu tenha te ajudado!

Estude mais: https://sampwiki.blast.hk/wiki/ShowPlayerDialog
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)