02.03.2010, 16:53
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 ![Cheesy](images/smilies/biggrin.png)
Errors: those are still left any1 can help?
Line 405 - 407
OnPlayerSelectedMenuRow:
![Cheesy](images/smilies/biggrin.png)
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
Код:
if(current == Pistolsmenu) 405 { 406 switch(row) 407
Код:
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; } } }