dialog problem -
bare380 - 29.05.2014
Hey. i have a dialog DIALOG_STYLE_MSGBOX.
but when i click yes, nothing happens. but when i click no, it works
it doesn't say any messages when you click yes
here is the code
Код:
format(string,sizeof(string), "Do you really want to buy %s for $%d?", AccessNames[listitem][modname], AccessNames[listitem][modprice]);
ShowPlayerDialog(playerid, 283, DIALOG_STYLE_MSGBOX, "Buy Accessories", string, "Yes", "No");
Код:
if(dialogid == 283) // ID is Buying Accessories
{
if(response)
{
if(!IsAtClothShop(playerid)) {
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
isplayerumtd[playerid] = 0;
return SendClientMessage(playerid,COLOR_GREY," You are not at a clothes shop.");
}
new biz = GetPlayerVirtualWorld(playerid);
if(GetMoney(playerid) < AccessNames[listitem][modprice]) {
isplayerumtd[playerid] = 0;
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
return SendClientMessage(playerid, COLOR_GRAD1, " You don't have enough money!");
}
new freeslot = -1;
for(new i = 0; i < 7; i++)
{
if(Accessories[playerid][i] == 0)
{
freeslot = i;
break;
}
}
if(freeslot == -1) {
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
isplayerumtd[playerid] = 0;
return SendClientMessage(playerid, COLOR_GRAD1, " You don't have an empty slot!");
}
Accessories[playerid][freeslot] = AccessNames[listitem][modid];
AccessoriesB[playerid][freeslot] = 1;
AccessoriessX[playerid][freeslot] = 1;
AccessoriessY[playerid][freeslot] = 1;
AccessoriessZ[playerid][freeslot] = 1;
BizInfo[biz][bTill] += AccessNames[listitem][modprice];
BizInfo[biz][bProducts] -= 1;
GiveMoney(playerid, -AccessNames[listitem][modprice]);
SendClientMessage(playerid, COLOR_GRAD1, " Tajhiz kharide shod! /inventory ra baraye estefade bezanid!");
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
isplayerumtd[playerid] = 0;
}
else
{
isplayerumtd[playerid] = 0;
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
new hugestring[4048];
for(new i = 0; i < sizeof(AccessNames); i++)
{
format(hugestring, sizeof(hugestring), "%s\n%s ($%d)", hugestring, AccessNames[i][modname], AccessNames[i][modprice]);
}
ShowPlayerDialog(playerid, 2420, DIALOG_STYLE_LIST, "Accessories", hugestring, "Buy", "Cancel");
}
}
Re: dialog problem -
TheSimpleGuy - 29.05.2014
Then change the "Yes" to "No", vice versa.
Re: dialog problem -
bare380 - 29.05.2014
No, the no works perfectly
but the yes doesn't work at all
Re: dialog problem -
Lacamora - 29.05.2014
PHP код:
if(dialogid == 283) // ID is Buying Accessories
{
if(response)
{
new biz = GetPlayerVirtualWorld(playerid);
if(GetMoney(playerid) < AccessNames[listitem][modprice]) {
isplayerumtd[playerid] = 0;
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
return SendClientMessage(playerid, COLOR_GRAD1, " You don't have enough money!");
}
new freeslot = -1;
for(new i = 0; i < 7; i++)
{
if(Accessories[playerid][i] == 0)
{
freeslot = i;
break;
}
}
if(freeslot == -1) {
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
isplayerumtd[playerid] = 0;
return SendClientMessage(playerid, COLOR_GRAD1, " You don't have an empty slot!");
}
Accessories[playerid][freeslot] = AccessNames[listitem][modid];
AccessoriesB[playerid][freeslot] = 1;
AccessoriessX[playerid][freeslot] = 1;
AccessoriessY[playerid][freeslot] = 1;
AccessoriessZ[playerid][freeslot] = 1;
BizInfo[biz][bTill] += AccessNames[listitem][modprice];
BizInfo[biz][bProducts] -= 1;
GiveMoney(playerid, -AccessNames[listitem][modprice]);
SendClientMessage(playerid, COLOR_GRAD1, " Tajhiz kharide shod! /inventory ra baraye estefade bezanid!");
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
isplayerumtd[playerid] = 0;
}
else
{
isplayerumtd[playerid] = 0;
TextDrawHideForPlayer(playerid, centerMHUDInfo[playerid]);
new hugestring[4048];
for(new i = 0; i < sizeof(AccessNames); i++)
{
format(hugestring, sizeof(hugestring), "%s\n%s ($%d)", hugestring, AccessNames[i][modname], AccessNames[i][modprice]);
}
ShowPlayerDialog(playerid, 2420, DIALOG_STYLE_LIST, "Accessories", hugestring, "Buy", "Cancel");
}
}
Re: dialog problem -
bare380 - 30.05.2014
Doesn't work.
i said if you click yes, it doesn't give you any errors.
Re: dialog problem -
bare380 - 30.05.2014
oh, i found out the problem.
the problem was that in the dialog_style_msgbox there is no listitem.
so i saved it in a variable.
and used it on the dialog 283.
thanks anyways.