[Ajuda] Dialog
#1

Bom meu gm tem um sistema de cash e eu estava tentado criar um sistema onde o player trocava cash por dinheiro
So que eu n sei se isto esta certo e se estiver como que eu passarei para dialog

Mas tipo o player que tivesse cash ia la na dialog e digitava quanto de cash iria trocar e a cada 100.000 cash e 1kk de dinheito
ou seja a cada 10 cash e 1 dinheiro

alg pode me ajudar ?

+rep

pawn Код:
new value = strval(inputtext);
      if(value < 0 || value > Player[playerid][CashVerde])
       SendClientMessage(playerid, COLOR_RED,"[ERRO] Quantia invбlida.");

   else
   {
       player[i][Cashverde] -- value;
       GivePlayerGP(giveid, value);
    new str[128];
    format(str,128,"[PH]Vocк Trocou cash por dinheiro", value);
       SendClientMessage(playerid, COLOR_GOLD,str);
   }
Reply
#2

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CASH)
    {
        if(response)
        {
            new value = strval(inputtext);
            if(value < 0 || value > Player[playerid][CashVerde]) return SendClientMessage(playerid, COLOR_RED,"[ERRO] Quantia invбlida.");

            player[i][Cashverde] -= value;
            GivePlayerGP(giveid, value);
            new str[128];
            format(str,128,"[PH]Vocк Trocou cash por dinheiro", value);
            SendClientMessage(playerid, COLOR_GOLD,str);
        }
        return 1;
    }
 
    return 0;
}
Reply
#3

Quote:
Originally Posted by Bruno13
Посмотреть сообщение
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CASH)
    {
        if(response)
        {
            new value = strval(inputtext);
            if(value < 0 || value > Player[playerid][CashVerde]) return SendClientMessage(playerid, COLOR_RED,"[ERRO] Quantia invбlida.");

            player[i][Cashverde] -= value;
            GivePlayerGP(giveid, value);
            new str[128];
            format(str,128,"[PH]Vocк Trocou cash por dinheiro", value);
            SendClientMessage(playerid, COLOR_GOLD,str);
        }
        return 1;
    }
 
    return 0;
}
agr como que eu faзo pra defenir o valo do cash pelo dinheiro
Reply
#4

alg ?
Reply
#5

Quote:
Originally Posted by BigRet
Посмотреть сообщение
alg ?
Nгo testei
pawn Код:
#include <a_samp>

#define DIALOG_CASH                                              9999
#define VALOR_CASH                                               2
#define MAX_DINHEIRO                                             999999


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cash", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_CASH, DIALOG_STYLE_INPUT, "Venda de Cash","100.000 vale 1kk", "Comprar", "Cancelar");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CASH)
    {
        new Dcash = strval(inputtext),
        quantia = Dcash*floatround(VALOR_CASH);

        if(Dcash > MAX_DINHEIRO || Dcash <= 0) return SendClientMessage(playerid, 0xFF0000AA, "Quantia Invбlida");
        {
            GivePlayerMoney(playerid,  Dcash);
            GivePlayerMoney(playerid, - quantia);
        }
    }
    return 1;
}
Reply
#6

Quote:
Originally Posted by Marlon307
Посмотреть сообщение
Nгo testei
pawn Код:
#include <a_samp>

#define DIALOG_CASH                                              9999
#define VALOR_CASH                                               2
#define MAX_DINHEIRO                                             999999


public OnPlayerCommandText(playerid, cmdtext[])
{
    if (strcmp("/cash", cmdtext, true, 10) == 0)
    {
        ShowPlayerDialog(playerid, DIALOG_CASH, DIALOG_STYLE_INPUT, "Venda de Cash","100.000 vale 1kk", "Comprar", "Cancelar");
        return 1;
    }
    return 0;
}

public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    if(dialogid == DIALOG_CASH)
    {
        new Dcash = strval(inputtext),
        quantia = Dcash*floatround(VALOR_CASH);

        if(Dcash > MAX_DINHEIRO || Dcash <= 0) return SendClientMessage(playerid, 0xFF0000AA, "Quantia Invбlida");
        {
            GivePlayerMoney(playerid,  Dcash);
            GivePlayerMoney(playerid, - quantia);
        }
    }
    return 1;
}
MAn eu fiz tudo certo botei minha variaveis e etc com a quantia mas oque esta dando errado й o preзo do dinheiro tipo

eu queria fazer tipo um pacote que a cada 100.000 era 1kk ou seja a cada 1 cash era 10 de dinheiro so que eu n sei como eu faзo podem me ajudar e o dinheiro que troca n salva n sei pq oque eu faзo ?
Reply
#7

alg ?
Reply
#8

Posta o comando amigo que vc usa para Trocar cash por dinheiro para ver se o erro nao estб no comando.
Reply
#9

pawn Код:
if(listitem == 3)
            {

             format(STRINGDLL,sizeof(STRINGDLL),"A Cada 100.000 BPL Cash Gera 1.000.000 Em dinheiro");
             strcat(DialogInfoorg,STRINGDLL);
             ShowPlayerDialog(playerid, 9929, DIALOG_STYLE_INPUT, "Brasil Play Life Trocar Cash por dinheiro", DialogInfoorg,  "Comprar", "Cancelar");
             return 1;

           }
pawn Код:
case 9929:
            {
              {
                new value = strval(inputtext);
                value = value*floatround(VALOR_CASH);
                if(value > MAX_DINHEIRO || Player[playerid][CashVerde]  <= 0 ) return SendClientMessage(playerid, COLOR_RED,"[ERRO] Quantia invбlida.");
                 {
                   GivePlayerMoney(playerid,  value);
                   Player[playerid][CashVerde] -= value;
                 }

               }
            }
Reply
#10

Estou dizendo o comando exemplo: /trocar. , /cash etc...
Poste tambem as define que vc estб usando no no codigo.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)