11.04.2014, 01:57
Sorry for all of my posts guys, but I have another question.
How can I make it so when a user clicks "Cancel" or presses escape in the Dialog, that it gives them no items at all and simply closes the box. What's happening at the moment is when I press cancel or escape, it gives me the crack(as this is for getting crack), when it shouldn't. I'll show all of the code; tell me if it's something there or if I need to add something. Thanks in advance!
How can I make it so when a user clicks "Cancel" or presses escape in the Dialog, that it gives them no items at all and simply closes the box. What's happening at the moment is when I press cancel or escape, it gives me the crack(as this is for getting crack), when it shouldn't. I'll show all of the code; tell me if it's something there or if I need to add something. Thanks in advance!
Код:
if(dialogid == 101) { if(listitem == 0) { new money = GetPlayerMoney(playerid); if(money >= 20) { GivePlayerMoney(playerid, -20); PlayerDrugInfo[playerid][pCrack]++; SendClientMessage(playerid, COLOR_BLUE, "You have just purchased a gram of crack!"); } else { SendClientMessage(playerid, -1, "You need 20 dollars to purchase a gram of crack!"); } } if(listitem == 1) { new money = GetPlayerMoney(playerid); if(money >= 70) { GivePlayerMoney(playerid, -70); PlayerDrugInfo[playerid][pCrack] += 4; SendClientMessage(playerid, -1, "You have just purchased four grams of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 70 dollars to purchase four grams of crack!"); } } if(listitem == 2) { new money = GetPlayerMoney(playerid); if(money >= 130) { GivePlayerMoney(playerid, -130); PlayerDrugInfo[playerid][pCrack] += 7; SendClientMessage(playerid, -1, "You have just purchased a quad of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 130 dollars to purchase a quad of crack!"); } } if(listitem == 3) { new money = GetPlayerMoney(playerid); if(money >= 250) { GivePlayerMoney(playerid, -250); PlayerDrugInfo[playerid][pCrack] += 14; SendClientMessage(playerid, -1, "You have just purchased a half ounce of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 250 dollars to purchase a half ounce of crack!"); } } if(listitem == 4) { new money = GetPlayerMoney(playerid); if(money >= 470) { GivePlayerMoney(playerid, -470); PlayerDrugInfo[playerid][pCrack] += 28; SendClientMessage(playerid, -1, "You have just purchased an ounce of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 470 dollars to purchase an ounce of crack!"); } } if(listitem == 5) { new money = GetPlayerMoney(playerid); if(money >= 3400) { GivePlayerMoney(playerid, -3400); PlayerDrugInfo[playerid][pCrack] += 226; SendClientMessage(playerid, -1, "You have just purchased 8 ounces of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 3400 dollars to purchase 8 ounces of crack!"); } } if(listitem == 6) { new money = GetPlayerMoney(playerid); if(money >= 7000) { GivePlayerMoney(playerid, -7000); PlayerDrugInfo[playerid][pCrack] += 453; SendClientMessage(playerid, -1, "You have just purchased a pound of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 7000 dollars to purchase a pound of crack!"); } } if(listitem == 7) { new money = GetPlayerMoney(playerid); if(money >= 70000) { GivePlayerMoney(playerid, -70000); PlayerDrugInfo[playerid][pCrack] += 4535; SendClientMessage(playerid, -1, "You have just purchased 10 pounds of crack!"); } else { SendClientMessage(playerid, -1, "You need at least 70,000 dollars to purchase 10 pounds of crack!"); } } }
Код:
if(pickupid == CrackPickup) { ShowPlayerDialog(playerid,101,DIALOG_STYLE_LIST,""COL_BLUE"Chu' need some crack mang'?",""COL_ORANGE"One gram (20 dollars)\n"COL_ORANGE"Four grams (70 dollars)\n"COL_ORANGE"A quad: Seven grams (130 dollars)\n"COL_ORANGE"Half ounce: 14 grams (250 dollars)\n"COL_ORANGE"Ounce: 28 grams (470 dollars)\n"COL_ORANGE"8 ounces: 226 grams (3400 dollars)\n"COL_ORANGE"Pound: 453 grams (7000 dollars)\n"COL_ORANGE"10 pounds: 4535 (70,000 dollars)\n","Select","Cancel"); }