if(response) { switch(dialogid == 1101) { case 1: { switch(listitem) { case 0: { if(undead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 Undead Perk.."); if(GetPlayerMoney(playerid) < 25000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash."); GivePlayerMoney(playerid, -25000); SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $25.000, to use it type /undead"); undead[playerid] = 1; PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } case 1: { if(explose[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 One Shoot Explose Perk.."); if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash."); GivePlayerMoney(playerid, -50000); SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $50.000, to use it type /oe"); explose[playerid] = 1; PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } case 2: { if(shoot[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 One Shoot Kill Perk.."); if(GetPlayerMoney(playerid) < 70000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash."); GivePlayerMoney(playerid, -70000); SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $70.000, to use it type /ok"); shoot[playerid] = 1; PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } case 3: { if(tank[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 Tank Perk.."); if(GetPlayerMoney(playerid) < 350000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash."); GivePlayerMoney(playerid, -350000); SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $350.000, to use it type /tank"); tank[playerid] = 1; PlayerPlaySound(playerid,1057,0.0,0.0,0.0); } } } } } } } } return 0; }
public OnPlayerPickUpDynamicPickup(playerid, pickupid) { if(pickupid == perks) { ShowPlayerDialog(playerid, 1101, DIALOG_STYLE_LIST, "Perks Counter", "Undead Perk ($25.000)\nOne Shoot Explose ($50.000)\nOne Shoot Kill ($70.000)\nTank Perk($350.000)", "Purchase", "Close"); } return 1; }
if(dialogid == 1101)
{
switch(listitem)
{
case 0:
{
if(undead[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 Undead Perk..");
if(GetPlayerMoney(playerid) < 25000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
GivePlayerMoney(playerid, -25000);
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $25.000, to use it type /undead");
undead[playerid] = 1;
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
case 1:
{
if(explose[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 One Shoot Explose Perk..");
if(GetPlayerMoney(playerid) < 50000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
GivePlayerMoney(playerid, -50000);
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $50.000, to use it type /oe");
explose[playerid] = 1;
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
case 2:
{
if(shoot[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 One Shoot Kill Perk..");
if(GetPlayerMoney(playerid) < 70000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
GivePlayerMoney(playerid, -70000);
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $70.000, to use it type /ok");
shoot[playerid] = 1;
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
case 3:
{
if(tank[playerid] == 1) return SendClientMessage(playerid, COLOR_RED,"You can't buy more than 1 Tank Perk..");
if(GetPlayerMoney(playerid) < 350000) return SendClientMessage(playerid, COLOR_RED, "You don't have enough cash.");
GivePlayerMoney(playerid, -350000);
SendClientMessage(playerid,COLOR_GREEN,"You Bought Undead Perk for $350.000, to use it type /tank");
tank[playerid] = 1;
PlayerPlaySound(playerid,1057,0.0,0.0,0.0);
}
}
}
public OnDialogResponse()
{
if(response)
{
if(dialogid == DIALOG_ID)
{
return;
}
}
return 0;
}
Returning 0 in this callback will pass the dialog to another script in case no matching code were found in your gamemode's callback. |
Don't use "if(response)" outside of a dialog. By that I mean:
PHP код:
Returning zero couldn't be the problem. |
How could it be the problem if he isn't using a filterscript?
https://sampwiki.blast.hk/wiki/OnDialogResponse Read the return values for the callback. |