[Duvida] Dialog - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: Non-English (
https://sampforum.blast.hk/forumdisplay.php?fid=9)
+--- Forum: Languages (
https://sampforum.blast.hk/forumdisplay.php?fid=33)
+---- Forum: Português/Portuguese (
https://sampforum.blast.hk/forumdisplay.php?fid=34)
+---- Thread: [Duvida] Dialog (
/showthread.php?tid=323097)
[Duvida] Dialog -
Saw_BR - 04.03.2012
como botar esse cmd em dialog?
na caixinha para depositar
pawn Код:
CMD:deposit(playerid, params[]) {
new
cash,
string[128];
if(sscanf(params, "d", cash)) return SendClientMessage(playerid, COLOR_GREY, SYNTAX_MESSAGE"/deposit [amount]");
else if(cash <= 0) return SendClientMessage(playerid, COLOR_GREY, "Invalid amount specified.");
else {
if(IsPlayerInRangeOfPoint(playerid, 15.0, 2306.8481,-16.0682,26.7496) && GetPlayerVirtualWorld(playerid) == 2) {
if(playerVariables[playerid][pMoney] < cash) SendClientMessage(playerid, COLOR_GREY, "You don't have enough money for this transaction.");
else if(cash >= 1) {
playerVariables[playerid][pBankMoney] += cash;
playerVariables[playerid][pMoney] -= cash;
format(string, sizeof(string), "You have deposited $%d into your bank account. Your account balance is now $%d.", cash, playerVariables[playerid][pBankMoney]);
SendClientMessage(playerid, COLOR_DCHAT, string);
}
else SendClientMessage(playerid, COLOR_GREY, "Invalid amount specified.");
}
else {
SendClientMessage(playerid, COLOR_GREY, "You're not at the bank.");
}
}
return 1;
}
Re: [Duvida] Dialog -
humildadeforever - 04.03.2012
Tenta assim.
Comando:
pawn Код:
CMD:deposit(playerid, params[])
{
ShowPlayerDialog(playerid, ID, DIALOG_STYLE_INPUT,"Depositando","Digite o valor que deseja depositar","Depositar","Cancelar");//troca o ID por um numero q nao esteja sendo usado como id de dialog
return 1;
}
Em OnDialogResponse:
pawn Код:
if(dialogid == ID) //troca ID pelo numero q colocou no ShowPlayerDialog
{
if(!response) return SendClientMessage(playerid,-1,"Vocк cancelou o depуsito.");
if(!strval(inputtext)) return ShowPlayerDialog(playerid, ID, DIALOG_STYLE_INPUT,"Depositando","Digite o valor que deseja depositar (apenas numeros)","Depositar","Cancelar");//mesmo id dos outros, pois й o mesmo dialog
if(GetPlayerMoney(playerid) < 1) return SendClientMessage(playerid,-1,"Vocк й tгo pobre q nгo tem nem 1 real pra depositar kkkkk");
new grana = strval(inputtext);
if(grana < 1) return ShowPlayerDialog(playerid, ID, DIALOG_STYLE_INPUT,"Depositando","O valor tem que ser maior ou igual a 1, pгo duro","Depositar","Cancelar");//mesmo id dos outros, pois й o mesmo dialog
if(!IsPlayerInRangeOfPoint(playerid, 15.0, 2306.8481,-16.0682,26.7496) && GetPlayerVirtualWorld(playerid) != 2) return SendClientMessage(playerid,-1,"Vocк nгo estб no banco.");
if(playerVariables[playerid][pMoney] < grana) SendClientMessage(playerid, COLOR_GREY, "You don't have enough money for this transaction.");
playerVariables[playerid][pBankMoney] += grana;
playerVariables[playerid][pMoney] -= grana;
format(string, sizeof(string), "You have deposited $%d into your bank account. Your account balance is now $%d.", grana, playerVariables[playerid][pBankMoney]);
SendClientMessage(playerid, COLOR_DCHAT, string);
return 1;
}
acho q dб, tenta ae
Re: [Duvida] Dialog -
Saw_BR - 04.03.2012
-----"
BUG da para depositar 100000000000000000000000000000000000
Re: [Duvida] Dialog -
Saw_BR - 04.03.2012
@CloseD
comecei a ler sobre e conssegui fazer um sem bug
obrigado msm assim