OnDialogResponse Problem -
calin1996 - 28.05.2012
Lines:
pawn Код:
if(dialogid == 382)// bancomat extrage
{
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY," Nu ati tastat suma !");
return 1;
}
new cashdeposit = strval(inputtext);
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu aveti asa mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
new string[500];
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ati scos suma de %d RON din contul dumneavoastra. Total Cont: %d RON. Va multumim pentru ca ati folosit bancomatul!", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
return 1;
}
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Va multumim pentru ca ati folosit bancomatul!");
}
return 1;
}
}
Errors:
pawn Код:
D:\Lucru\1.3 samp 0.3e\gamemodes\inaintedetaxi2.pwn(59315) : warning 225: unreachable code
D:\Lucru\1.3 samp 0.3e\gamemodes\inaintedetaxi2.pwn(59350) : error 054: unmatched closing brace ("}")
Error lines:
pawn Код:
59315: if(dialogid == 382)// bancomat extrage
pawn Код:
59350: ->the last bracket }
HELP ME PLEASE

(
Re: OnDialogResponse Problem -
CidadeNovaRP - 28.05.2012
Try this:
pawn Код:
if(dialogid == 382)// bancomat extrage
{
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY," Nu ati tastat suma !");
return 1;
}
new cashdeposit = strval(inputtext);
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu aveti asa mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
new string[500];
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ati scos suma de %d RON din contul dumneavoastra. Total Cont: %d RON. Va multumim pentru ca ati folosit bancomatul!", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Va multumim pentru ca ati folosit bancomatul!");
}
return 1;
}
Re: OnDialogResponse Problem -
calin1996 - 28.05.2012
The callback looks like this:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response)
{
switch(dialogid)
{
case DIALOG_LOGIN:
{
//strmid(tmppass, tmp, 0, strlen(cmdtext), 255); // Sorry don't know how its works onplayercommandtext, you didnt show all code so i change it to inputtext to get the text from dialog input
//Encrypt(inputtext);
OnPlayerLogin(playerid,inputtext);
}
case DIALOG_REGISTER:
{
//strmid(tmppass, tmp, 0, strlen(cmdtext), 255); // Sorry don't know how its works onplayercommandtext, you didnt show all code so i change it to inputtext to get the text from dialog input
//Encrypt(inputtext);
if(strlen(inputtext) < 2 /*|| strlen(inputtext) > MAX Characters*/)
{
SendClientMessage(playerid, COLOR_YELLOW, "Parola trebuie sa aiba minim 2 caractere!");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register:","|_______________________________________|\nDepartamentul de emigrari: Te rugam sa prezinti pasaportul.\n Scrie-ti parola dedesubt pentru a te inregistra","Register","Cancel");
}
else
{
OnPlayerRegister(playerid,inputtext);
}
}
}
return 0;
}
else
{
if(IsPlayerNPC(playerid))return 1;
Kick(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Pai daca nu vrei ce cauti pe server?!");
return 1;
}
if(dialogid == 382)// bancomat extrage
{
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY," Nu ati tastat suma !");
return 1;
}
new cashdeposit = strval(inputtext);
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu aveti asa mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
new string[500];
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ati scos suma de %d RON din contul dumneavoastra. Total Cont: %d RON. Va multumim pentru ca ati folosit bancomatul!", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Va multumim pentru ca ati folosit bancomatul!");
}
}
return 1;
}
Error:
pawn Код:
(59315) : warning 225: unreachable code
Error lines:
pawn Код:
59315: if(dialogid == 382)// bancomat extrage
Re: OnDialogResponse Problem -
CidadeNovaRP - 28.05.2012
Try:
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == DIALOG_LOGIN)
{
if(response == 1)
{
//strmid(tmppass, tmp, 0, strlen(cmdtext), 255); // Sorry don't know how its works onplayercommandtext, you didnt show all code so i change it to inputtext to get the text from dialog input
//Encrypt(inputtext);
OnPlayerLogin(playerid,inputtext);
}
else
{
if(IsPlayerNPC(playerid))return 1;
Kick(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Pai daca nu vrei ce cauti pe server?!");
}
}
else if(dialogid == DIALOG_REGISTER)
{
if(response == 1)
{
//strmid(tmppass, tmp, 0, strlen(cmdtext), 255); // Sorry don't know how its works onplayercommandtext, you didnt show all code so i change it to inputtext to get the text from dialog input
//Encrypt(inputtext);
if(strlen(inputtext) < 2 /*|| strlen(inputtext) > MAX Characters*/)
{
SendClientMessage(playerid, COLOR_YELLOW, "Parola trebuie sa aiba minim 2 caractere!");
ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_PASSWORD,"Register:","|_______________________________________|\nDepartamentul de emigrari: Te rugam sa prezinti pasaportul.\n Scrie-ti parola dedesubt pentru a te inregistra","Register","Cancel");
}
else
{
OnPlayerRegister(playerid,inputtext);
}
}
else
{
if(IsPlayerNPC(playerid))return 1;
Kick(playerid);
SendClientMessage(playerid, COLOR_YELLOW, "Pai daca nu vrei ce cauti pe server?!");
}
}
else if(dialogid == 382)// bancomat extrage
{
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY," Nu ati tastat suma !");
return 1;
}
new cashdeposit = strval(inputtext);
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu aveti asa mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
new string[500];
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ati scos suma de %d RON din contul dumneavoastra. Total Cont: %d RON. Va multumim pentru ca ati folosit bancomatul!", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Va multumim pentru ca ati folosit bancomatul!");
}
}
return 1;
}
Re: OnDialogResponse Problem -
calin1996 - 28.05.2012
I have:
pawn Код:
//-----------------------------------ATM--------------------------------------------------------
if(strcmp(cmd, "/bwithdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3, playerid,658.9031,-496.3253,16.3359) || PlayerToPoint(3, playerid,564.2574,-1292.9720,17.2482) || PlayerToPoint(3, playerid,301.0207,-203.2226,1.5781))
{
new BancomatString[1024];
strins(BancomatString,"{00CC00}Extragere cont:",strlen(BancomatString));
ShowPlayerDialog(playerid,382,DIALOG_STYLE_INPUT,BancomatString,"Tastati mai jos suma pe care doriti sa o extrageti.\nComision: 5%","Extrage","Renunta");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nu esti langa un Bancomat !");
return 1;
}
}
return 1;
}
And:
pawn Код:
public OnDialogResponseOthers(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 382)// bancomat extrage
{
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY," Nu ati tastat suma !");
return 1;
}
new cashdeposit = strval(inputtext);
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu aveti asa mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
new string[500];
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ati scos suma de %d RON din contul dumneavoastra. Total Cont: %d RON. Va multumim pentru ca ati folosit bancomatul!", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Va multumim pentru ca ati folosit bancomatul!");
}
}
return 1;
}
When i use the command,all is normal,but when i hit EXTRACT, the dialog close instead of withdraw.
Re: OnDialogResponse Problem -
calin1996 - 28.05.2012
Help??
Re: OnDialogResponse Problem - HuSs3n - 28.05.2012
make sure you dont have other dialog with same id (382)
also if you use filterscripts add return 0; under OnDialogResponse callback
Re: OnDialogResponse Problem -
Legolas.W - 28.05.2012
Change dialog id
Re: OnDialogResponse Problem -
calin1996 - 29.05.2012
It only a dialogid 382!
Re: OnDialogResponse Problem -
calin1996 - 29.05.2012
I've converted this:
pawn Код:
if(strcmp(cmd, "/bwithdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3, playerid,658.9031,-496.3253,16.3359) || PlayerToPoint(3, playerid,564.2574,-1292.9720,17.2482) || PlayerToPoint(3, playerid,301.0207,-203.2226,1.5781))
{
tmp = strtok(cmdtext, idx);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "UTILIZEAZA: /bwithdraw [suma]");
format(string, sizeof(string), " Ai %d RON In contul tau.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
new cashdeposit = strval(tmp);
if(!strlen(tmp))
{
SendClientMessage(playerid, COLOR_GRAD2, "UTILIZEAZA: /bwithdraw [suma]");
format(string, sizeof(string), " Ai %d RON in contul tau.", PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_GRAD3, string);
return 1;
}
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu ai asa de mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ai scos suma de %d RON din contul tau. Total Cont: %d RON ", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
return 1;
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nu esti langa un Bancomat !");
return 1;
}
}
return 1;
}
Into this:
pawn Код:
if(strcmp(cmd, "/bwithdraw", true) == 0)
{
if(IsPlayerConnected(playerid))
{
if(PlayerToPoint(3, playerid,658.9031,-496.3253,16.3359) || PlayerToPoint(3, playerid,564.2574,-1292.9720,17.2482) || PlayerToPoint(3, playerid,301.0207,-203.2226,1.5781))
{
new BancomatString[1024];
strins(BancomatString,"{00CC00}Extragere cont:",strlen(BancomatString));
ShowPlayerDialog(playerid,382,DIALOG_STYLE_INPUT,BancomatString,"Tastati mai jos suma pe care doriti sa o extrageti.\nComision: 5%","Extrage","Renunta");
}
else
{
SendClientMessage(playerid, COLOR_GREY, " Nu esti langa un Bancomat !");
return 1;
}
}
return 1;
}
pawn Код:
public OnDialogResponseOthers(playerid, dialogid, response, listitem, inputtext[])
{
if(dialogid == 382)// bancomat extrage
{
if(response == 1)
{
if(!strlen(inputtext))
{
SendClientMessage(playerid,COLOR_GREY," Nu ati tastat suma !");
return 1;
}
new cashdeposit = strval(inputtext);
if (cashdeposit > PlayerInfo[playerid][pAccount] || cashdeposit < 1)
{
SendClientMessage(playerid, COLOR_GRAD2, " Nu aveti asa mult !");
return 1;
}
//ConsumingMoney[playerid] = 1;
new proc = (cashdeposit*5)/100;
new bani = cashdeposit-proc;
new string[500];
SafeGivePlayerMoney(playerid,bani);
PlayerInfo[playerid][pAccount]=PlayerInfo[playerid][pAccount]-bani-proc;
format(string, sizeof(string), " Ati scos suma de %d RON din contul dumneavoastra. Total Cont: %d RON. Va multumim pentru ca ati folosit bancomatul!", bani,PlayerInfo[playerid][pAccount]);
SendClientMessage(playerid, COLOR_YELLOW, string);
BizzInfo[3][bTill] += proc;
BizzInfo[4][bTill] += proc;
BizzInfo[18][bTill] += proc;
}
else
{
SendClientMessage(playerid, COLOR_WHITE, "Va multumim pentru ca ati folosit bancomatul!");
}
}
return 1;
}
And when i hit EXTRAGE button,the dialog is closing instead of withdraw the amount of money inserted there!