27.11.2009, 17:00
Ok so I wanna optimize my menu a little (save some lines) but dunno if this will work..
Right now it's like this (ignore the screwed up tabs):
Would it be possible to do it like this?:
Or will this not work? If not, is there another way to not repeat the same code on every case..?
Right now it's like this (ignore the screwed up tabs):
pawn Код:
if(CurrentMenu == CopOnD)
{
switch(row)
{
case 0:
{
gTeam[playerid] = TEAM_WSPD;
SetPlayerColor(playerid, COLOR_BLUE);
SetPlayerSkin(playerid, 71);
GivePlayerWeapon(playerid,24,100);
GivePlayerWeapon(playerid,3,1);
SendClientMessage(playerid, COLOR_WSPD, "You're on Cop Duty, shoot ($100) or jail ($150) some criminals");
}
case 1:
{
gTeam[playerid] = TEAM_WSPD;
SetPlayerColor(playerid, COLOR_BLUE);
SetPlayerSkin(playerid, 280);
GivePlayerWeapon(playerid,24,100);
GivePlayerWeapon(playerid,3,1);
SendClientMessage(playerid, COLOR_WSPD, "You're on Cop Duty, shoot ($100) or jail ($150) some criminals");
}
case 2:
{
gTeam[playerid] = TEAM_WSPD;
SetPlayerColor(playerid, COLOR_WSPD);
SetPlayerSkin(playerid, 281);
GivePlayerWeapon(playerid,24,100);
GivePlayerWeapon(playerid,3,1);
SendClientMessage(playerid, COLOR_BLUE, "You're on Cop Duty, shoot ($100) or jail ($150) some criminals");
}
//etc...
pawn Код:
if(CurrentMenu == CopOnD)
{
switch(row)
{
gTeam[playerid] = TEAM_WSPD;
SetPlayerColor(playerid, COLOR_BLUE);
GivePlayerWeapon(playerid,24,100);
GivePlayerWeapon(playerid,3,1);
SendClientMessage(playerid, COLOR_WSPD, "You're on Cop Duty, shoot ($100) or jail ($150) some criminals");
case 0:
{
SetPlayerSkin(playerid, 71);
}
case 1:
{
SetPlayerSkin(playerid, 280);
}
case 2:
{
SetPlayerSkin(playerid, 281);
}