12.08.2013, 11:56
Don't switch to your old code, mine does exactly same thing but is a little nicer. And for the love of God, indent your code (tab, and shift+tab are your friends)! If you did it, you could see that you have one brace too much which causes premature callback block end.
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
if(response) {
switch (dialogid) {
case 20320: {
switch(listitem)
{
case 0:
{
ShowPlayerDialog(playerid, 20321 , DIALOG_STYLE_LIST , "Weapon Shop" , "9mm(3500$)\nSilenced 9mm(4000$)", "Buy", "Exit");
}
}
}
case 20321: {
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) < 4000) return SendClientMessage(playerid , 0xFFFFFFFF , "You don't have enough money");
GivePlayerWeapon(playerid , 22 , 100);
GivePlayerMoney(playerid , -4000);
SendClientMessage(playerid, 0xFFFFFFFF , "You have bought a 9mm for $4000");
}
case 1:
{
if(GetPlayerMoney(playerid) < 4500) return SendClientMessage(playerid , 0xFFFFFFFF, "You don't have enough money");
GivePlayerWeapon(playerid , 23 , 100);
GivePlayerMoney(playerid , -4500);
SendClientMessage(playerid , 0xFFFFFFFF , "You have bought a silenced pistol");
}
}
}
case 1338: {
if(0 == listitem)
{
ShowPlayerDialog(playerid , 1339 , DIALOG_STYLE_LIST , "Car Shop" , "Cadrona($20 000)\nBlista($60 000)" , "Buy" , "Exit");
}
}
case 1339: {
if(!listitem)
{
if(GetPlayerMoney(playerid) < 20000) return SendClientMessage(playerid , 0xFFFFFFFF , "You don't have enough money");
CreateVehicle(527 , 210.6137 , -8.0158 , 2.5338 , 1 , 1 , 500);
GivePlayerMoney(playerid -20000);
SendClientMessage(playerid , 0x489048FF , "-----------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "You have bought Cadrona for $20 000!");
}
else
{
if(GetPlayerMoney(playerid) < 60000) return SendClientMessage(playerid , 0xFFFFFFFF , "You don't have enough money");
CreateVehicle(496 , 210.6137 , -8.0158 , 2.5338 , 1 , 1 , 500)
GivePlayerMoney(playerid -60000)
SendClientMessage(playerid , 0x489048FF , "-----------------------------------------------------");
SendClientMessage(playerid , 0x489048FF , "You have bought Blista Compact for $60 000!");
}
}
}
}
return 1;
}