Dialog -
BigRet - 23.08.2014
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);
}
Re: Dialog -
Bruno13 - 23.08.2014
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;
}
Re: Dialog -
BigRet - 23.08.2014
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
Re: Dialog -
BigRet - 23.08.2014
alg ?
Re: Dialog -
Marlon307 - 23.08.2014
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;
}
Re: Dialog -
BigRet - 24.08.2014
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 ?
Re: Dialog -
BigRet - 24.08.2014
alg ?
Re: Dialog -
MaGnO_357 - 24.08.2014
Posta o comando amigo que vc usa para Trocar cash por dinheiro para ver se o erro nao estб no comando.
Re: Dialog -
BigRet - 24.08.2014
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;
}
}
}
Re: Dialog -
MaGnO_357 - 24.08.2014
Estou dizendo o comando exemplo: /trocar. , /cash etc...
Poste tambem as define que vc estб usando no no codigo.