[Ajuda] Comandos em Dialog
#1

Queria colocar esses 3 comandos em Dialog , aqui as coordenadas de onde pode ser usado o comando .
if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797 ))


pawn Код:
if(strcmp(cmd, "/loteria", true) == 0)
    {
        if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797))
        {
            if(PlayerInfo[playerid][pLottoNr] > 0)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк jб tem um bilhete de loteria !");
                return true;
            }
            if(GetPlayerMoney(playerid) < 10)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Vocк nгo tem R$10 para pagar o nъmero de loteria !");
                return true;
            }
            tmp = strtok(cmdtext, idx);
            if(!strlen(tmp))
            {
                SendClientMessage(playerid, COLOR_WHITE,"USE: /loteria [nъmero]");
                return true;
            }
            new lottonr = strval(tmp);
            if(lottonr < 1 || lottonr > 80)
            {
                SendClientMessage(playerid, COLOR_GREY, "   Nъmero da loteria, de 1 a 80 !");
                return true;
            }
            format(string, sizeof(string), "* Vocк comprou um bilhete de loteria com nъmero: %d.", lottonr);
            SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
            GivePlayerMoney(playerid, - 10);
            PlayerInfo[playerid][pLottoNr] = lottonr;
         }
         else
         {
            SendClientMessage(playerid, COLOR_GRAD1, "   Vocк nгo estб na Lotйrica !");
         }
         return true;
    }
        if(strcmp(cmd, "/mudarsexo", true) == 0)
    {
        if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            new x_sexo[32];
            x_sexo = strtok(cmdtext, idx);
            if(!strlen(x_sexo))
            {
                SendClientMessage(playerid, COLOR_WHITE, "|______________ Cartуrio ______________|");
                SendClientMessage(playerid, COLOR_WHITE, "|Use: /mudarsexo [Numero]");
                SendClientMessage(playerid, COLOR_GREY, "| 1 - Homem");
                SendClientMessage(playerid, COLOR_GREY, "| 2 - Mulher");
                return true;
            }
            if(strcmp(x_sexo,"1",true) == 0)
            {
                format(string, sizeof(string), "* Jogador %s mudou seu sexo para masculino.", PlayerName(playerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                PlayerInfo[playerid][pSex] = 1;
                SendClientMessage(playerid,COLOR_GREEN,"Vocк mudou seu sexo para masculino!");
                return true;
            }
            if(strcmp(x_sexo,"2",true) == 0)
            {
                format(string, sizeof(string), "* Jogador %s mudou seu sexo para feminino.", PlayerName(playerid));
                ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                PlayerInfo[playerid][pSex] = 2;
                SendClientMessage(playerid,COLOR_GREEN,"Vocк trocou seu sexo para feminino!");
                return true;
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк nгo estб na igreja de LS.");
        }
    }//Separaзгo
    if(strcmp(cmd, "/separacao", true) == 0)
    {
        if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797))
        {
            GetPlayerName(playerid, sendername, sizeof(sendername));
            if(IsPlayerConnected(playerid))
            {
                new x_separar[32];
                x_separar = strtok(cmdtext, idx);
                if(!strlen(x_separar))
                {
                    SendClientMessage(playerid, COLOR_WHITE, "|______________ Cartуrio ______________|");
                    SendClientMessage(playerid, COLOR_WHITE, "|Use: /separacao [Numero]");
                    SendClientMessage(playerid, COLOR_GREY, "| 1 - Sim");
                    SendClientMessage(playerid, COLOR_GREY, "| 2 - Nгo");
                    return true;
                }
                if(strcmp(x_separar,"1",true) == 0)
                {
                    if(PlayerInfo[playerid][pMarried] > 0)
                    {
                        format(string, sizeof(string), "* Jogador %s se divorciou!", PlayerName(playerid));
                        ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                        SendClientMessage(playerid,COLOR_GREY,"Vocк se divorciou!");
                        ClearMarriage(playerid);
                        return true;
                    }
                    SendClientMessage(playerid,COLOR_GREEN,"Vocк nгo й casado(a)!");
                }
                if(strcmp(x_separar,"2",true) == 0)
                {
                    if(PlayerInfo[playerid][pMarried] > 0)
                    {
                        SendClientMessage(playerid,COLOR_GREEN,"Vocк continuou casado(a)!");
                        return true;
                    }
                }
            }
        }
        else
        {
            SendClientMessage(playerid, COLOR_LIGHTRED, "Vocк nгo estб na igreja de LS!");
        }
    }
Reply
#2

pawn Код:
// Em OnPlayerKeyStateChange

if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797 ))
{
    ShowPlayerDialog(playerid,1784,DIALOG_STYLE_LIST,"Lotйrica","Comprar um Bilhete\nMudar o Sexo para Masculino\nMudar o Sexo para Feminino","Escolher","Cancelar");
}

// Em OnDialogResponse

if(dialogid == 1784)
{
    if(response)
    {
        if(listitem == 0)
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        if(listitem == 1)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
        if(listitem == 2)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
    }
    return 1;
}
if(dialogid == 1785)
{
    if(response)
    {
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        new ID = strval(inputtext); new Fala[20];
       
        format(Fala,sizeof(Fala),"/loteria %d",inputtext);
        OnPlayerCommandText(playerid,Fala);
    }
    return 1;
}
Reply
#3

O dialog funcionou , mas se eu digito n°10 no Dialog aparece vocк comprou o blilhete de n° 50 ;
Reply
#4

pawn Код:
// Em OnPlayerKeyStateChange

if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797 ))
{
    ShowPlayerDialog(playerid,1784,DIALOG_STYLE_LIST,"Lotйrica","Comprar um Bilhete\nMudar o Sexo para Masculino\nMudar o Sexo para Feminino","Escolher","Cancelar");
}

// Em OnDialogResponse

if(dialogid == 1784)
{
    if(response)
    {
        if(listitem == 0)
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        if(listitem == 1)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
        if(listitem == 2)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
    }
    return 1;
}
if(dialogid == 1785)
{
    if(response)
    {
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        new lottonr = strval(inputtext);

        if(lottonr < 1 || lottonr > 80)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Nъmeros de 1 a 80.");
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
            return true;
        }
        format(string, sizeof(string), "* Vocк comprou um bilhete de loteria com nъmero: %d.", lottonr);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        GivePlayerMoney(playerid, - 10);
        PlayerInfo[playerid][pLottoNr] = lottonr;
    }
    return 1;
}
Reply
#5

Acho que agora funcionou , qualquer coisa dou um Edit , sу faltou o /separacao como faзo ?

+Rep pra vocк .
Reply
#6

pawn Код:
// Em OnPlayerKeyStateChange

if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797 ))
{
    ShowPlayerDialog(playerid,1784,DIALOG_STYLE_LIST,"Lotйrica","Comprar um Bilhete\nMudar o Sexo para Masculino\nMudar o Sexo para Feminino\nSe separar","Escolher","Cancelar");
}

// Em OnDialogResponse

if(dialogid == 1784)
{
    if(response)
    {
        if(listitem == 0)
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        if(listitem == 1)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
        if(listitem == 2)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
        if(listitem == 3)
        {
            OnPlayerCommandText(playerid,"/separacao");
        }
    }
    return 1;
}
if(dialogid == 1785)
{
    if(response)
    {
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        new lottonr = strval(inputtext);

        if(lottonr < 1 || lottonr > 80)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Nъmeros de 1 a 80.");
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
            return true;
        }
        format(string, sizeof(string), "* Vocк comprou um bilhete de loteria com nъmero: %d.", lottonr);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        GivePlayerMoney(playerid, - 10);
        PlayerInfo[playerid][pLottoNr] = lottonr;
    }
    return 1;
}
Reply
#7

Mas no caso , tem que digitar /separacao 1 para Sim e 2 para Nгo , o codigo tб correto ?
Reply
#8

pawn Код:
// Em OnPlayerKeyStateChange

if (PlayerToPoint(2, playerid,830.6808,-0.2795,1004.1797) || PlayerToPoint(2,playerid,833.5997,3.2969,1004.1797 ))
{
    ShowPlayerDialog(playerid,1784,DIALOG_STYLE_LIST,"Lotйrica","Comprar um Bilhete\nMudar o Sexo para Masculino\nMudar o Sexo para Feminino\nSe separar","Escolher","Cancelar");
}

// Em OnDialogResponse

if(dialogid == 1784)
{
    if(response)
    {
        if(listitem == 0)
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        if(listitem == 1)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 1");
        }
        if(listitem == 2)
        {
            OnPlayerCommandText(playerid,"/mudarsexo 2");
        }
        if(listitem == 3)
        {
            OnPlayerCommandText(playerid,"/separacao 1");
        }
    }
    return 1;
}
if(dialogid == 1785)
{
    if(response)
    {
        if(!strlen(inputtext))
        {
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
        }
        new lottonr = strval(inputtext);

        if(lottonr < 1 || lottonr > 80)
        {
            SendClientMessage(playerid, COLOR_GREY, "   Nъmeros de 1 a 80.");
            ShowPlayerDialog(playerid,1785,DIALOG_STYLE_INPUT,"Lotйrica","Digite o nъmero do bilhete que deseja comprar","Comprar","Cancelar");
            return true;
        }
        format(string, sizeof(string), "* Vocк comprou um bilhete de loteria com nъmero: %d.", lottonr);
        SendClientMessage(playerid, COLOR_LIGHTBLUE, string);
        GivePlayerMoney(playerid, - 10);
        PlayerInfo[playerid][pLottoNr] = lottonr;
    }
    return 1;
}
Ta aew
Reply
#9

Funcionou perfeitamente , Obrigado .
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)