24.07.2012, 17:32
I have this code under OnDialogResponse:
If I remove that case D_SHOP, no errors at all, everything fine.
If I keep the code there:
Added comments after error lines.
pawn Код:
//
case D_SHOP:
{
if(response)
{
if(listitem == 0)
{
if(GetPlayerMoney(playerid) >= 2500)
{
GivePlayerMoney(playerid, -2500);
SetPlayerHealth(playerid, 100);
SCM(playerid, C_LGREEN, "Health refilled! It cost $2500!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 1)
if(GetPlayerMoney(playerid) >= 3000)
{
GivePlayerMoney(playerid, -3000);
SetPlayerArmour(playerid, 100);
SCM(playerid, C_LGREEN, "Armour refilled! It cost $3000!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 2)
{
if(GetPlayerMoney(playerid) >= 500)
{
GivePlayerMoney(playerid, -500);
GivePlayerWeapon(playerid, 4, 1);
SCM(playerid, C_LGREEN, "You bought a knife! It cost $500!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 3)
{
if(GetPlayerMoney(playerid) >= 1000)
{
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 9, 1);
SCM(playerid, C_LGREEN, "You bought a chainsaw! It cost $1000!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 4)
{
if(GetPlayerMoney(playerid) >= 1500)
{
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 24, 50);
SCM(playerid, C_LGREEN, "You bought a Deagle! It cost $1500!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 5)
{
if(GetPlayerMoney(playerid) >= 3500)
{
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 27, 50);
SCM(playerid, C_LGREEN, "You bought a Combat Shotgun! It cost $3500!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 6)
{
if(GetPlayerMoney(playerid) >= 2000)
{
GivePlayerMoney(playerid, -1500);
GivePlayerWeapon(playerid, 29, 50);
SCM(playerid, C_LGREEN, "You bought a MP5! It cost $1500!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 7)
{
if(GetPlayerMoney(playerid) >= 3500)
{
GivePlayerMoney(playerid, -3500);
GivePlayerWeapon(playerid, 31, 50);
SCM(playerid, C_LGREEN, "You bought a M4! It cost $3500!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
if(listitem == 8)
{
if(GetPlayerMoney(playerid) >= 1000)
{
GivePlayerMoney(playerid, -1000);
GivePlayerWeapon(playerid, 8, 1);
SCM(playerid, C_LGREEN, "You bought a Katana! It cost $1000!");
}
else return SendClientMessage(playerid, C_RED, "Not enough money!");
}
}
}
}
return 1;
}
If I keep the code there:
pawn Код:
Desktop\SA-MP\Battlefield Server 1.2\gamemodes\GM.pwn(1083) : warning 217: loose indentation
Desktop\SA-MP\Battlefield Server 1.2\gamemodes\GM.pwn(1155) : warning 209: function "OnDialogResponse" should return a value
Desktop\SA-MP\Battlefield Server 1.2\gamemodes\GM.pwn(1156) : error 010: invalid function or declaration