Weapon menu errors
#1

Hey, i was trying to make my first menu, and as i was done it got a couple errors and i hope someone cut try help me fix them

Errors: those are still left any1 can help?

Код:
(405) : error 002: only a single statement (or expression) can follow each "case"
(405 -- 406) : error 028: invalid subscript (not an array or too many subscripts): "current"
(405 -- 407) : error 001: expected token: "}", but found "switch"
(405 -- 407) : fatal error 107: too many error messages on one line
Line 405 - 407

Код:
  if(current == Pistolsmenu) 405
  {                 406
    switch(row)        407
OnPlayerSelectedMenuRow:

Код:
public OnPlayerSelectedMenuRow(playerid, row)
{
  new Menu:current;
  current = GetPlayerMenu(playerid);
  if(current == weaponmenu)
  {
    switch(row)
    {
      case 0: ShowMenuForPlayer(Fistmenu,playerid);
      case 1: ShowMenuForPlayer(Pistolsmenu,playerid);
      case 2: ShowMenuForPlayer(MicroSMGmenu,playerid);
      case 3: ShowMenuForPlayer(Shotgunsmenu,playerid);
      case 4: ShowMenuForPlayer(Armourmenu,playerid);
      case 5: ShowMenuForPlayer(SMGmenu,playerid);
      case 6: ShowMenuForPlayer(Assaultmenu,playerid);
      case 7: ShowMenuForPlayer(Riflesmenu,playerid);
      case 8: ShowMenuForPlayer(Healthmenu,playerid);
    }
  }
  if(current == Fistmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 499)
 			{
			GivePlayerWeapon(playerid,4,1);
			GivePlayerMoney(playerid,-500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Knife");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Knife");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 499)
 			{
			GivePlayerWeapon(playerid,8,1);
			GivePlayerMoney(playerid,-500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Katana");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Katana");
 			return 1;
 			}
 			}
      case 2:
 			{
 			if(GetPlayerMoney(playerid) > 499)
 			{
			GivePlayerWeapon(playerid,8,1);
			GivePlayerMoney(playerid,-500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Chainsaw");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Chainsaw");
 			return 1;
		}
	}
  if(current == Pistolsmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 999)
 			{
			GivePlayerWeapon(playerid,22,50);
			GivePlayerMoney(playerid,-1000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a 9mm");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a 9mm");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 999)
 			{
			GivePlayerWeapon(playerid,23,50);
			GivePlayerMoney(playerid,-1000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Silenced 9mm");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Silenced 9mm");
 			return 1;
 			}
 			}
      case 2:
 			{
 			if(GetPlayerMoney(playerid) > 1499)
 			{
			GivePlayerWeapon(playerid,24,25);
			GivePlayerMoney(playerid,-1500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Desert Eagle");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Desert Eagle");
 			return 1;
		}
	}
  if(current == MicroSMGsmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 1999)
 			{
			GivePlayerWeapon(playerid,28,200);
			GivePlayerMoney(playerid,-2000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Micro SMG");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Micro SMG");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 1999)
 			{
			GivePlayerWeapon(playerid,32,250);
			GivePlayerMoney(playerid,-2000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Tec 9");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Tec 9");
 			return 1;
		}
	}
  if(current == Shotgunsmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 2499)
 			{
			GivePlayerWeapon(playerid,25,40);
			GivePlayerMoney(playerid,-2500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Shotgun");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Shotgun");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 2499)
 			{
			GivePlayerWeapon(playerid,26,40);
			GivePlayerMoney(playerid,-2500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Sawn-off Shotgun");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Sawn-off Shotgun");
 			return 1;
 			}
 			}
			case 2:
 			{
 			if(GetPlayerMoney(playerid) > 2999)
 			{
			GivePlayerWeapon(playerid,27,30);
			GivePlayerMoney(playerid,-3000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Combat Shotgun");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Combat Shotgun");
 			return 1;
		}
	}
  if(current == Armourmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 499)
 			{
			SetPlayerArmour(playerid, 100);
			GivePlayerMoney(playerid,-500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Body Armour");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Body Armour");
 			return 1;
		}
	}
  if(current == SMGmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 2499)
 			{
			GivePlayerWeapon(playerid,29,90);
			GivePlayerMoney(playerid,-2500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a SMG");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a SMG");
 			return 1;
		}
	}
  if(current == Assaultmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 4999)
 			{
			GivePlayerWeapon(playerid,30,90);
			GivePlayerMoney(playerid,-5000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a AK-47");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a AK-47");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 4999)
 			{
			GivePlayerWeapon(playerid,21,50);
			GivePlayerMoney(playerid,-5000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a M4");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a M4");
 			return 1;
		}
	}
  if(current == Riflesmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 2999)
 			{
			GivePlayerWeapon(playerid,33,50);
			GivePlayerMoney(playerid,-3000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Country Rifle");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Country Rifle");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 2999)
 			{
			GivePlayerWeapon(playerid,34,50);
			GivePlayerMoney(playerid,-3000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Sniper Rifle");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Sniper Rifle");
 			return 1;
		}
	}
  if(current == Healthmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 499)
 			{
			SetPlayerHealth(playerid, 100);
			GivePlayerMoney(playerid,-500);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Health Pack");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Health Pack");
 			return 1;
			}
			}

}
Reply
#2

its GetPlayerMoney not GetPlayerCash
________
WAGE INSURANCE FORUMS
Reply
#3

Quote:
Originally Posted by [AC
Etch ]
its GetPlayerMoney not GetPlayerCash
Thanks a lot, small errors big mistakes
Reply
#4

urw
________
California Medical Marijuana Dispensary
Reply
#5

Can you fix the last 4 also? i just can't see what's wrong with 406
Reply
#6

plz show me the exact lines like :
errors bablablablabla : line : .....
________
LovelyWendie
Reply
#7

(42 : error 002: only a single statement (or expression) can follow each "case"

if(current == Pistolsmenu) (line 42



(428 -- 429) : error 028: invalid subscript (not an array or too many subscripts): "current"

if(current == Pistolsmenu) (line 42
{ (line 429)



(428 -- 430) : error 001: expected token: "}", but found "switch"
(428 -- 430) : fatal error 107: too many error messages on one line

if(current == Pistolsmenu) (line 42
{ (line 429)
switch(row) (line 430)
Reply
#8

why dont u just use dialogs it's much easier and faster :
My Weapons Menu (dialog):
http://forum.sa-mp.com/index.php?topic=156554.0
________
Oregon Marijuana Dispensary
Reply
#9

expected token: "}", but found "switch"
i think that means ur missing a "}" in the script recheck the script
________
Michigan Dispensary
Reply
#10

No1 knows how to fix those errors: ??

Код:
(601) : error 002: only a single statement (or expression) can follow each "case"
(601 -- 602) : error 028: invalid subscript (not an array or too many subscripts): "current"
(601 -- 603) : error 001: expected token: "}", but found "switch"
(601 -- 603) : fatal error 107: too many error messages on one line
Line 601 - 634
Код:
	if(current == Pistolsmenu)
  {
    switch(row)
    {
      case 0:
 			{
 			if(GetPlayerMoney(playerid) > 999)
 			{
			GivePlayerWeapon(playerid,22,50);
			GivePlayerMoney(playerid,-1000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a 9mm");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a 9mm");
 			return 1;
 			}
 			}
      case 1:
 			{
 			if(GetPlayerMoney(playerid) > 999)
 			{
			GivePlayerWeapon(playerid,23,50);
			GivePlayerMoney(playerid,-1000);
 			SendClientMessage(playerid,COLOUR_YELLOW,"Bought a Silenced 9mm");
 			return 1;
 			}
 			else
 			{
 			SendClientMessage(playerid,COLOUR_RED,"You can't afford a Silenced 9mm");
 			return 1;
 			}
 			}
I'd really appreciate if you cut!

-Naxix
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)