11.03.2014, 18:57
I've been having issues with my dialog and I'm trying to script an ammunation system so you can buy weapons with /buy inside an ammunation. I've done it all except the dialog appearing where I get two errors.
The command which shows players the selected dialog:
^^ Works fine I believe -- no errors.
I haven't shown the whole OnDialogResponse because 2/3 of it is my register system but if it's required then I will post it.
Errors:
Any help will certainly be appreciated and I'm willing to rep them.
The command which shows players the selected dialog:
pawn Код:
CMD:buy(playerid,params[])
{
if(IsPlayerInRangeOfPoint(playerid,45.0,308.059,-141.153,999.601)) // ammunation
{
if(PlayerInfo[playerid][pWepLicense] == 0) return SendClientMessage(playerid,COLOR_GREY,"You require a weapons license before purchasing weapons.");
else
ShowPlayerDialog(playerid,5,DIALOG_STYLE_LIST,"Ammunation","Colt .45 - $350\nGlock .17 - $1200\nRemington 1100 - $550\n.223 HMR Rifle - $600","Purchase","Exit");
return 1;
}
return 1;
}
pawn Код:
if(dialogid == 5) // LINE 989
{
if(response)
switch(listitem)
{
case 0:
{
if(GetPlayerMoney(playerid) >= 350) return SendClientMessage(playerid,COLOR_GREY,"You cannot afford this weapon.");
GivePlayerMoney(playerid,-350);
GivePlayerWeapon(playerid,22,200);
SendClientMessage(playerid,COLOR_GREY,"You have purchased a Colt .45!");
return 1;
}
case 1:
{
if(GetPlayerMoney(playerid) >= 1200) return SendClientMessage(playerid,COLOR_GREY,"You cannot afford this weapon.");
GivePlayerMoney(playerid,-1200);
GivePlayerWeapon(playerid,24,150);
SendClientMessage(playerid,COLOR_GREY,"You have purchased a Glock .17!");
return 1;
}
case 2:
{
if(GetPlayerMoney(playerid) >= 550) return SendClientMessage(playerid,COLOR_GREY,"You cannot afford this weapon.");
GivePlayerMoney(playerid,-550);
GivePlayerWeapon(playerid,25,50);
SendClientMessage(playerid,COLOR_GREY,"You have purchased a Remington 1100!");
return 1;
}
case 3:
{
if(GetPlayerMoney(playerid) >= 600) return SendClientMessage(playerid,COLOR_GREY,"You cannot afford this weapon.");
GivePlayerMoney(playerid,-600);
GivePlayerWeapon(playerid,33,90);
SendClientMessage(playerid,COLOR_GREY,"You have purchased a .223 HMR Rifle!");
return 1;
}
}
}
return 1;
}
Errors:
pawn Код:
C:\Users\Jack\Desktop\SF RP\gamemodes\sfrp.pwn(989) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Jack\Desktop\SF RP\gamemodes\sfrp.pwn(989 -- 990) : error 029: invalid expression, assumed zero
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
2 Errors.

