29.05.2014, 17:06
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
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");
}
}

