Menu Weird Error? -
hadzx - 01.11.2010
basicly i already have a menu and im making another and i copyed the 1st bit and pasted and get 1 error :/
il paste all the code of it
Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
if(GetPlayerMenu(playerid) == CarShop)
{
switch(row)
{
case 0:
{
//car shop bit ere
}
else<<<errors here ;/
{
//car shop bit ere 2 ;D
}
}
if(GetPlayerMenu(playerid) == Shop)
{
switch(row)
{
case 0:
{
if(GetPlayerMoney(playerid) > 199)
{
GivePlayerMoney(playerid,-200);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Parachute For 200$");
GameTextForPlayer(playerid, "~g~Parachute Bought For 200$", 1000, 5);
GivePlayerWeapon(playerid, 46, 1);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 200$");
GameTextForPlayer(playerid, "~r~You Dont Have 200$", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
case 1:
{
if(GetPlayerMoney(playerid) > 749)
{
GivePlayerMoney(playerid,-750);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Desert Eagle With 100Shots For 750$");
GameTextForPlayer(playerid, "~g~Desert Eagle Bought For 750$", 1000, 5);
GivePlayerWeapon(playerid, 24, 100);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 750$");
GameTextForPlayer(playerid, "~r~You Dont Have 750$", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
case 2:
{
if(GetPlayerMoney(playerid) > 49)
{
GivePlayerMoney(playerid,-50);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Knife For 50$");
GameTextForPlayer(playerid, "~g~Knife Bought For 50$", 1000, 5);
GivePlayerWeapon(playerid, 4, 1);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 50$");
GameTextForPlayer(playerid, "~r~You Dont Have 50$", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
case 3:
{
if(GetPlayerMoney(playerid) > 14999)
{
GivePlayerMoney(playerid,-15000);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Chainsaw For 50$");
GameTextForPlayer(playerid, "~g~Chainsaw Bought For 50$", 1000, 5);
GivePlayerWeapon(playerid, 9, 1);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 15k");
GameTextForPlayer(playerid, "~r~You Dont Have 15K", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
}
}
}
the error
Код:
error 002: only a single statement (or expression) can follow each "case"
Re: Menu Weird Error? -
Jeffry - 01.11.2010
pawn Код:
if(GetPlayerMenu(playerid) == CarShop)
{
switch(row)
{
//The Menu bits:
case 0:
{
//Here we have the FIRST Bit of the Menu.
//And now we split it up, if he has money or not.
if(GetPlayerMoney(playerid) > 999)
{
//Okey, here you add what you want, if he HAS the money, means he can buy the item.
}
//Now the "else", means, If he does NOT have the money (Lower then 1000).
else
{
//Here you add what you want to tell him, if he does NOT have the cash.
}
}
//First Bit is done now. Lets go on with the second:
case 1:
{
//Now go on here, like on the first one.
//It is important, that you keep the Indentation clear, then you see Bracket Errors faster.
}
//More cases...
//Now we end the Bit switching.
}
//And where we return 1, so the code stops, as we have finished working with the "CarShop".
return 1;
}
// More Menu's here....
I hope this helps you to understand it.
If you have questions, just ask.
Jeffry
Re: Menu Weird Error? -
hadzx - 01.11.2010
EDIT : the same error ;/ add my msn
garystep@hotmail.co.uk
Re: Menu Weird Error? -
Jeffry - 01.11.2010
pawn Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
if(GetPlayerMenu(playerid) == CarShop)
{
switch(row)
{
//The Menu bits:
case 0:
{
//Here we have the FIRST Bit of the Menu.
//And now we split it up, if he has money or not.
if(GetPlayerMoney(playerid) > 999)
{
//Okey, here you add what you want, if he HAS the money, means he can buy the item.
}
//Now the "else", means, If he does NOT have the money (Lower then 1000).
else
{
//Here you add what you want to tell him, if he does NOT have the cash.
}
}
//First Bit is done now. Lets go on with the second:
case 1:
{
//Now go on here, like on the first one.
//It is important, that you keep the Indentation clear, then you see Bracket Errors faster.
}
//More cases...
//Now we end the Bit switching.
}
//And where we return 1, so the code stops, as we have finished working with the "CarShop".
return 1;
}
// More Menu's here....
if(GetPlayerMenu(playerid) == Shop)
{
switch(row)
{
case 0:
{
if(GetPlayerMoney(playerid) > 199)
{
GivePlayerMoney(playerid,-200);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Parachute For 200$");
GameTextForPlayer(playerid, "~g~Parachute Bought For 200$", 1000, 5);
GivePlayerWeapon(playerid, 46, 1);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 200$");
GameTextForPlayer(playerid, "~r~You Dont Have 200$", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
case 1:
{
if(GetPlayerMoney(playerid) > 749)
{
GivePlayerMoney(playerid,-750);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Desert Eagle With 100Shots For 750$");
GameTextForPlayer(playerid, "~g~Desert Eagle Bought For 750$", 1000, 5);
GivePlayerWeapon(playerid, 24, 100);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 750$");
GameTextForPlayer(playerid, "~r~You Dont Have 750$", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
case 2:
{
if(GetPlayerMoney(playerid) > 49)
{
GivePlayerMoney(playerid,-50);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Knife For 50$");
GameTextForPlayer(playerid, "~g~Knife Bought For 50$", 1000, 5);
GivePlayerWeapon(playerid, 4, 1);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 50$");
GameTextForPlayer(playerid, "~r~You Dont Have 50$", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
case 3:
{
if(GetPlayerMoney(playerid) > 14999)
{
GivePlayerMoney(playerid,-15000);
SendClientMessage(playerid,0xFFFFFFFF,"You Bought A Chainsaw For 50$");
GameTextForPlayer(playerid, "~g~Chainsaw Bought For 50$", 1000, 5);
GivePlayerWeapon(playerid, 9, 1);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
else
{
SendClientMessage(playerid,0xFFFFFFFF,"You dont have 15k");
GameTextForPlayer(playerid, "~r~You Dont Have 15K", 1000, 5);
TogglePlayerControllable(playerid,0);
ShowMenuForPlayer(Shop,playerid);
}
}
}
}
return 1;
}
This is the Full callback now. I compiled it, and it worked fine.
Try it.
Re: Menu Weird Error? -
hadzx - 01.11.2010
Thanks It Worked
Re: Menu Weird Error? -
Jeffry - 01.11.2010
Quote:
Originally Posted by hadzx
Thanks It Worked 
|
Nice. Thanks for the feedback.
Have fun.