Dialog list as 24/7 when press cancel takes money - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Dialog list as 24/7 when press cancel takes money (
/showthread.php?tid=270369)
Dialog list as 24/7 when press cancel takes money -
slymatt - 20.07.2011
I have my Dialog list working exept for one thing when i press cancel it still takes the money away from you.
This is the actual dialog box:
Код:
if(pickupid == noob247)
{
ShowPlayerDialog(playerid, DIALOG_NOOB247, DIALOG_STYLE_LIST, "24/7 Shopping Cart", "Test1($10)\nTest2($20)\nTest3($30)", "Purchase","Cancel");
}
This is the code behind the dialog:
Код:
case DIALOG_NOOB247:
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
GivePlayerMoney(playerid, -10);
}
case 1:
{
if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
GivePlayerMoney(playerid, -20);
}
case 2:
{
if(GetPlayerMoney(playerid) < 30) return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
GivePlayerMoney(playerid, -30);
}
case 3:
{
return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
}
}
Re: Dialog list as 24/7 when press cancel takes money -
PotH3Ad - 20.07.2011
pawn Код:
case DIALOG_NOOB247:
{
if(response)
{
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 10) return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
GivePlayerMoney(playerid, -10);
}
case 1:
{
if(GetPlayerMoney(playerid) < 20) return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
GivePlayerMoney(playerid, -20);
}
case 2:
{
if(GetPlayerMoney(playerid) < 30) return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
GivePlayerMoney(playerid, -30);
}
case 3:
{
return SendClientMessage(playerid, COLOUR_YELLOW, "You cant afford this item.");
}
}
}
}
Re: Dialog list as 24/7 when press cancel takes money -
XGh0stz - 20.07.2011
0 would be your Cancel Button if I'm not mistaken
(So this would only execute if the player has use response 1 (Purchase Button)
But the reason its taking away money & purchasing the item regardless is because the list item is selected when players hit the cancel button, the response check will help determine which button the player has pressed...
Re: Dialog list as 24/7 when press cancel takes money -
slymatt - 20.07.2011
that worked thanks allot pal =). Respecpa
Regards Matt