Help: Switch in other Switch
#1

hi guys, i have a problem, what is the way for add a "switch" in other "switch"??, i am try using but got bad results, it dont work... Someone can help me??

PHP код:
forward ClassSelection(playeridlistitem);
public 
ClassSelection(playeridlistitem)
{
switch(
listitem) <----------------- Dont workI dont know why?
{
case 
0: {
  switch(
random(6)) // Negros
  
{
        case 
0:
        {
         switch(
random(8))
         {
                 case 
0: {SetPlayerSkin(playerid21);}
                 case 
1: {SetPlayerSkin(playerid19);}
                 case 
2: {SetPlayerSkin(playerid183);}
                 case 
3: {SetPlayerSkin(playerid104);}
                 case 
4: {SetPlayerSkin(playerid28);}
                 case 
5: {SetPlayerSkin(playerid22);}
                 case 
6: {SetPlayerSkin(playerid190);}
                 case 
7: {SetPlayerSkin(playerid195);}
         }
         
SetPlayerPos(playerid, -2636.9077,260.5389,4.3281);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
1:
        {
         switch(
random(8))
         {
                 case 
0: {SetPlayerSkin(playerid21);}
                 case 
1: {SetPlayerSkin(playerid19);}
                 case 
2: {SetPlayerSkin(playerid183);}
                 case 
3: {SetPlayerSkin(playerid104);}
                 case 
4: {SetPlayerSkin(playerid28);}
                 case 
5: {SetPlayerSkin(playerid22);}
                 case 
6: {SetPlayerSkin(playerid190);}
                 case 
7: {SetPlayerSkin(playerid195);}
         }
         
SetPlayerPos(playerid, -2659.7424,260.6835,4.6328);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
2:
        {
         switch(
random(8))
         {
                 case 
0: {SetPlayerSkin(playerid21);}
                 case 
1: {SetPlayerSkin(playerid19);}
                 case 
2: {SetPlayerSkin(playerid183);}
                 case 
3: {SetPlayerSkin(playerid104);}
                 case 
4: {SetPlayerSkin(playerid28);}
                 case 
5: {SetPlayerSkin(playerid22);}
                 case 
6: {SetPlayerSkin(playerid190);}
                 case 
7: {SetPlayerSkin(playerid195);}
         }
         
SetPlayerPos(playerid, -2695.9822,262.4749,4.6328);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
3:
        {
         switch(
random(8))
         {
                 case 
0: {SetPlayerSkin(playerid21);}
                 case 
1: {SetPlayerSkin(playerid19);}
                 case 
2: {SetPlayerSkin(playerid183);}
                 case 
3: {SetPlayerSkin(playerid104);}
                 case 
4: {SetPlayerSkin(playerid28);}
                 case 
5: {SetPlayerSkin(playerid22);}
                 case 
6: {SetPlayerSkin(playerid190);}
                 case 
7: {SetPlayerSkin(playerid195);}
         }
         
SetPlayerPos(playerid, -2694.5286,276.3913,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
4:
        {
         switch(
random(8))
         {
                 case 
0: {SetPlayerSkin(playerid21);}
                 case 
1: {SetPlayerSkin(playerid19);}
                 case 
2: {SetPlayerSkin(playerid183);}
                 case 
3: {SetPlayerSkin(playerid104);}
                 case 
4: {SetPlayerSkin(playerid28);}
                 case 
5: {SetPlayerSkin(playerid22);}
                 case 
6: {SetPlayerSkin(playerid190);}
                 case 
7: {SetPlayerSkin(playerid195);}
         }
         
SetPlayerPos(playerid,-2659.1301,275.6968,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
5:
        {
         switch(
random(8))
         {
                 case 
0: {SetPlayerSkin(playerid21);}
                 case 
1: {SetPlayerSkin(playerid19);}
                 case 
2: {SetPlayerSkin(playerid183);}
                 case 
3: {SetPlayerSkin(playerid104);}
                 case 
4: {SetPlayerSkin(playerid28);}
                 case 
5: {SetPlayerSkin(playerid22);}
                 case 
6: {SetPlayerSkin(playerid190);}
                 case 
7: {SetPlayerSkin(playerid195);}
         }
         
SetPlayerPos(playerid, -2665.8315,237.6608,4.3359);
         
GivePlayerWeapon(playerid30150);
         
GivePlayerWeapon(playerid2550);
         
GivePlayerWeapon(playerid29150);
         
SetPlayerColor(playeridcolor_NEGROS);
        }
  }
}
case 
1: {
  switch(
random(6)) //Civiles
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid2);
         
SetSpawnInfo(playerid,1,2,-1762.0461,960.5403,24.8828,171.4048,26,100,29,150,24,20);
         
SetPlayerColor(playeridcolor_CIVILES);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid2);
         
SetSpawnInfo(playerid,1,2,-1771.2639,961.1591,24.8828,167.9581,26,100,29,150,24,20);
         
SetPlayerColor(playeridcolor_CIVILES);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid2);
         
SetSpawnInfo(playerid,1,2,-1751.0995,961.6115,24.8828,176.7314,26,100,29,150,24,20);
         
SetPlayerColor(playeridcolor_CIVILES);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid2);
         
SetSpawnInfo(playerid,1,2,-1739.0233,961.1733,24.8828,171.0913,26,100,29,150,24,20);
             
SetPlayerColor(playeridcolor_CIVILES);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid2);
         
SetSpawnInfo(playerid,1,2,-1743.8237,946.1083,24.8828,15.3633,26,100,29,150,24,20);
             
SetPlayerColor(playeridcolor_CIVILES);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid2);
         
SetSpawnInfo(playerid,1,2,-1764.9819,945.7482,24.8828,31.9701,26,100,29,150,24,20);
             
SetPlayerColor(playeridcolor_CIVILES);
        }
}
}
case 
2: {
  switch(
random(6)) // Mafia
        
{
    case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid124);
         
SetSpawnInfo(playerid,2,124,-2454.6692,139.8220,34.9609,313.0271,30,150,25,50,29,150);
             
SetPlayerColor(playeridcolor_MAFIA);
        }
    case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid124);
         
SetSpawnInfo(playerid,2,124,-2465.1528,158.7457,35.1797,260.3865,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_MAFIA);
        }
    case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid124);
         
SetSpawnInfo(playerid,2,124,-2449.1057,187.0281,35.1094,183.6425,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_MAFIA);
        }
    case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid124);
         
SetSpawnInfo(playerid,2,124,-2443.7385,157.4708,35.1328,80.8915,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_MAFIA);
        }
     case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid124);
         
SetSpawnInfo(playerid,2,124,-2479.0303,103.7202,35.1829,162.0456,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_MAFIA);
        }
    case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid124);
         
SetSpawnInfo(playerid,2,124,-2490.6843,128.5919,25.8672,82.4817,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_MAFIA);
        }
  }
}
case 
3:{
  switch(
random(6)) // Nang
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid122);
         
SetSpawnInfo(playerid,3,122,-1678.2971,1359.7749,6.8045,314.8831,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_NANG);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid122);
         
SetSpawnInfo(playerid,3,122,-1683.0354,1373.6479,7.1797,212.4220,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_NANG);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid122);
         
SetSpawnInfo(playerid,3,122,-1672.4862,1389.7667,9.8047,217.4589,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_NANG);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid122);
         
SetSpawnInfo(playerid,3,122,-1637.9294,1393.6322,9.8047,131.9175,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_NANG);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid122);
         
SetSpawnInfo(playerid,3,122,-1622.2827,1403.1455,7.1826,86.1703,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_NANG);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid122);
         
SetSpawnInfo(playerid,3,122,-1653.6068,1412.7996,7.1875,219.0248,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_NANG);
        }
  }
 }
case 
4:{
  switch(
random(6)) // Swat
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid285);
         
SetSpawnInfo(playerid,4,285,-1635.0077,665.8105,7.1875,264.2244,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_SWAT);
        }
         case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid285);
         
SetSpawnInfo(playerid,4,285,-1616.1135,678.0463,7.1875,178.0571,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_SWAT);
        }
         case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid285);
         
SetSpawnInfo(playerid,4,285,-1568.1500,723.5207,-4.9063,84.0327,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_SWAT);
        }
         case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid285);
         
SetSpawnInfo(playerid,4,285,-1668.7944,699.7700,30.6016,77.0743,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_SWAT);
        }
         case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid285);
         
SetSpawnInfo(playerid,4,285,-1582.5112,678.0520,7.1875,198.7212,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_SWAT);
        }
         case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid285);
         
SetSpawnInfo(playerid,4,285,-1637.2410,670.7408,7.1875,274.7658,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_SWAT);
        }
  }
}
case 
5:{
  switch(
random(6)) //Sureсos
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid108);
         
SetSpawnInfo(playerid,5,108,-2123.0313,-212.4085,34.9448,103.0335,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid108);
         
SetSpawnInfo(playerid,5,108,-2184.8193,-238.6618,36.5220,347.7257,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid108);
         
SetSpawnInfo(playerid,5,108,-2178.6587,-214.1436,36.5156,276.2614,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid108);
         
SetSpawnInfo(playerid,5,108,-2135.8870,-257.6828,35.3203,262.7646,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid108);
         
SetSpawnInfo(playerid,5,108,-2124.7539,-270.8351,35.3203,357.3689,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid108);
         
SetSpawnInfo(playerid,5,108,-2127.8025,-196.0021,35.3203,168.8363,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
  }
}
case 
6:{
  switch(
random(6)) //Biker
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid248);
         
SetSpawnInfo(playerid,6,248,-2180.8606,706.7700,53.8906,188.5527,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_BIKER);
        }
         case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid248);
         
SetSpawnInfo(playerid,6,248,-2173.2168,708.5998,53.8906,79.9423,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_BIKER);
        }
         case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid248);
         
SetSpawnInfo(playerid,6,248,-2181.6575,710.5045,53.8906,186.0117,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_BIKER);
        }
         case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid248);
         
SetSpawnInfo(playerid,6,248,-2185.4250,713.7176,53.8976,266.2257,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_BIKER);
        }
         case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid248);
         
SetSpawnInfo(playerid,6,248,-2179.8828,696.1923,53.8906,350.1999,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_BIKER);
        }
         case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid248);
         
SetSpawnInfo(playerid,6,248,-2173.5547,678.3575,55.1643,11.1934,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_BIKER);
        }
  }
}
case 
7:{
  switch(
random(6)) //Rich
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid295);
         
SetSpawnInfo(playerid,7,295,-2667.5515,906.6794,79.6682,153.4801,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_RICH);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid295);
         
SetSpawnInfo(playerid,7,295,-2672.0000,928.3350,79.7031,312.8954,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_RICH);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid295);
         
SetSpawnInfo(playerid,7,295,-2643.0881,934.8712,71.9531,169.5791,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_RICH);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid295);
         
SetSpawnInfo(playerid,7,295,-2667.0095,890.7147,79.7031,15.6586,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_RICH);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid295);
         
SetSpawnInfo(playerid,7,295,-2699.0244,919.0204,67.6009,247.8502,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_RICH);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid295);
         
SetSpawnInfo(playerid,7,295,-2665.0984,866.3409,76.2734,79.2985,30,150,32,150,24,50);
            
SetPlayerColor(playeridcolor_RICH);
        }
  }
}
case 
8:{
  switch(
random(6)) //Farmers
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid159);
         
SetSpawnInfo(playerid,8,159,-1058.2749,-1162.2968,128.8435,169.9164,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid159);
         
SetSpawnInfo(playerid,8,159,-1062.4131,-1189.3451,129.2188,279.5842,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid159);
         
SetSpawnInfo(playerid,8,159,-1036.6643,-1176.3632,129.2188,82.4956,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid159);
         
SetSpawnInfo(playerid,8,159,-1024.8270,-1150.3081,129.2188,63.6955,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid159);
         
SetSpawnInfo(playerid,8,159,-1070.8446,-1132.6522,129.2188,250.9748,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid159);
         
SetSpawnInfo(playerid,8,159,-1070.8446,-1132.6522,129.2188,250.9748,29,150,31,150,16,8);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
  }
}
case 
9:{
  switch(
random(6)) //Mechanic
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid50);
         
SetSpawnInfo(playerid,9,50,-473.5201,-513.6721,25.0684,178.2461,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid50);
         
SetSpawnInfo(playerid,9,50,-475.6059,-524.9758,25.5178,89.3053,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid50);
         
SetSpawnInfo(playerid,9,50,-477.4657,-531.2911,25.5296,93.6920,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid50);
         
SetSpawnInfo(playerid,9,50,-477.8717,-538.9334,25.5296,93.3787,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid50);
         
SetSpawnInfo(playerid,9,50,-502.8699,-512.2277,25.5234,271.9569,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid50);
         
SetSpawnInfo(playerid,9,50,-507.9384,-506.2292,25.5234,1.8847,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
  }
}
case 
10:{
  switch(
random(6)) // Pimp
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid296);
         
SetSpawnInfo(playerid,10,296,-2640.1396,1374.2184,7.1437,252.1212,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_PIMP);
        }
        case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid296);
         
SetSpawnInfo(playerid,10,296,-2650.6367,1377.7343,7.1873,281.2850,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_PIMP);
        }
        case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid296);
         
SetSpawnInfo(playerid,10,296,-2643.0452,1382.0310,7.1739,169.1104,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_PIMP);
        }
        case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid296);
         
SetSpawnInfo(playerid,10,296,-2633.2600,1382.8607,7.1810,193.2373,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_PIMP);
        }
        case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid296);
         
SetSpawnInfo(playerid,10,296,-2628.6982,1403.3459,7.0938,264.0513,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_PIMP);
        }
        case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid296);
         
SetSpawnInfo(playerid,10,296,-2618.9673,1414.7338,7.0938,242.4544,31,150,24,20,27,100);
            
SetPlayerColor(playeridcolor_PIMP);
        }
  }
}
case 
11:{
  switch(
random(6)) //Soldados
  
{
        case 
0:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid287);
         
SetSpawnInfo(playerid,11,287,-1335.4381,506.1993,11.1953,83.7755,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
         case 
1:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid287);
         
SetSpawnInfo(playerid,11,287,-1343.6302,495.4990,11.2027,352.2811,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
         case 
2:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid287);
         
SetSpawnInfo(playerid,11,287,-1345.2030,501.2993,18.2344,353.2445,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
         case 
3:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid287);
         
SetSpawnInfo(playerid,11,287,-1319.4777,493.7184,18.2344,279.8277,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
         case 
4:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid287);
         
SetSpawnInfo(playerid,11,287,-1324.1310,491.2367,22.5156,137.0422,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
         case 
5:
        {
         
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
         
SetPlayerSkin(playerid287);
         
SetSpawnInfo(playerid,11,287,-1336.6809,449.3867,7.1875,278.9795,30,150,25,50,29,150);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
  }
}
}

Reply
#2

It took me a while
Have in mind that, in most cases, you're doing it wrong if you repeat the same code

PHP код:
forward ClassSelection(playeridlistitem);
public 
ClassSelection(playeridlistitem)
{
    switch(
listitem)
    {
        case 
0// Negros
        
{
            switch(
random(7))
            {
                case 
0SetPlayerSkin(playerid21);
                case 
1SetPlayerSkin(playerid19);
                case 
2SetPlayerSkin(playerid183);
                case 
3SetPlayerSkin(playerid104);
                case 
4SetPlayerSkin(playerid28);
                case 
5SetPlayerSkin(playerid22);
                case 
6SetPlayerSkin(playerid190);
                case 
7SetPlayerSkin(playerid195);
            }
            
SetPlayerPos(playerid, -2636.9077,260.5389,4.3281);
            
GivePlayerWeapon(playerid30150);
            
GivePlayerWeapon(playerid2550);
            
GivePlayerWeapon(playerid29150);
            
SetPlayerColor(playeridcolor_NEGROS);
        }
        case 
1// Civiles
        
{
            switch(
random(5))
            {
                  case 
0SetSpawnInfo(playerid,1,2,-1762.0461,960.5403,24.8828,171.4048,26,100,29,150,24,20);
                case 
1SetSpawnInfo(playerid,1,2,-1771.2639,961.1591,24.8828,167.9581,26,100,29,150,24,20);
                case 
2SetSpawnInfo(playerid,1,2,-1751.0995,961.6115,24.8828,176.7314,26,100,29,150,24,20);
                case 
3SetSpawnInfo(playerid,1,2,-1739.0233,961.1733,24.8828,171.0913,26,100,29,150,24,20);
                case 
4SetSpawnInfo(playerid,1,2,-1743.8237,946.1083,24.8828,15.3633,26,100,29,150,24,20);
                case 
5SetSpawnInfo(playerid,1,2,-1764.9819,945.7482,24.8828,31.9701,26,100,29,150,24,20);
            }
            
SetPlayerSkin(playerid2);
            
SetPlayerColor(playeridcolor_CIVILES);
        }
        case 
2// Mafia
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,2,124,-2454.6692,139.8220,34.9609,313.0271,30,150,25,50,29,150);
                case 
1SetSpawnInfo(playerid,2,124,-2465.1528,158.7457,35.1797,260.3865,30,150,25,50,29,150);
                case 
2SetSpawnInfo(playerid,2,124,-2449.1057,187.0281,35.1094,183.6425,30,150,25,50,29,150);
                case 
3SetSpawnInfo(playerid,2,124,-2443.7385,157.4708,35.1328,80.8915,30,150,25,50,29,150);
                case 
4SetSpawnInfo(playerid,2,124,-2479.0303,103.7202,35.1829,162.0456,30,150,25,50,29,150);
                case 
5SetSpawnInfo(playerid,2,124,-2490.6843,128.5919,25.8672,82.4817,30,150,25,50,29,150);
            }
            
SetPlayerSkin(playerid124);
            
SetPlayerColor(playeridcolor_MAFIA);
        }
        case 
3// Nang
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,3,122,-1678.2971,1359.7749,6.8045,314.8831,30,150,32,150,24,50);
                case 
1SetSpawnInfo(playerid,3,122,-1683.0354,1373.6479,7.1797,212.4220,30,150,32,150,24,50);
                case 
2SetSpawnInfo(playerid,3,122,-1672.4862,1389.7667,9.8047,217.4589,30,150,32,150,24,50);
                case 
3SetSpawnInfo(playerid,3,122,-1637.9294,1393.6322,9.8047,131.9175,30,150,32,150,24,50);
                case 
4SetSpawnInfo(playerid,3,122,-1622.2827,1403.1455,7.1826,86.1703,30,150,32,150,24,50);
                case 
5SetSpawnInfo(playerid,3,122,-1653.6068,1412.7996,7.1875,219.0248,30,150,32,150,24,50);
            }
            
SetPlayerSkin(playerid122);
            
SetPlayerColor(playeridcolor_NANG);
        }
        case 
4// Swat
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,4,285,-1635.0077,665.8105,7.1875,264.2244,29,150,31,150,16,8);
                case 
1SetSpawnInfo(playerid,4,285,-1616.1135,678.0463,7.1875,178.0571,29,150,31,150,16,8);
                case 
2SetSpawnInfo(playerid,4,285,-1568.1500,723.5207,-4.9063,84.0327,29,150,31,150,16,8);
                case 
3SetSpawnInfo(playerid,4,285,-1668.7944,699.7700,30.6016,77.0743,29,150,31,150,16,8);
                case 
4SetSpawnInfo(playerid,4,285,-1582.5112,678.0520,7.1875,198.7212,29,150,31,150,16,8);
                case 
5SetSpawnInfo(playerid,4,285,-1637.2410,670.7408,7.1875,274.7658,29,150,31,150,16,8);
            }
            
SetPlayerSkin(playerid285);
            
SetPlayerColor(playeridcolor_SWAT);
        }
        case 
5//Surenos
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,5,108,-2123.0313,-212.4085,34.9448,103.0335,31,150,24,20,27,100);
                case 
1SetSpawnInfo(playerid,5,108,-2184.8193,-238.6618,36.5220,347.7257,31,150,24,20,27,100);
                case 
2SetSpawnInfo(playerid,5,108,-2178.6587,-214.1436,36.5156,276.2614,31,150,24,20,27,100);
                case 
3SetSpawnInfo(playerid,5,108,-2135.8870,-257.6828,35.3203,262.7646,31,150,24,20,27,100);
                case 
4SetSpawnInfo(playerid,5,108,-2124.7539,-270.8351,35.3203,357.3689,31,150,24,20,27,100);
                case 
5SetSpawnInfo(playerid,5,108,-2127.8025,-196.0021,35.3203,168.8363,31,150,24,20,27,100);
            }
            
SetPlayerSkin(playerid108);
            
SetPlayerColor(playeridcolor_SURENOS);
        }
        case 
6//Biker
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,6,248,-2180.8606,706.7700,53.8906,188.5527,30,150,25,50,29,150);
                case 
1SetSpawnInfo(playerid,6,248,-2173.2168,708.5998,53.8906,79.9423,30,150,25,50,29,150);
                case 
2SetSpawnInfo(playerid,6,248,-2181.6575,710.5045,53.8906,186.0117,30,150,25,50,29,150);
                case 
3SetSpawnInfo(playerid,6,248,-2185.4250,713.7176,53.8976,266.2257,30,150,25,50,29,150);
                case 
4SetSpawnInfo(playerid,6,248,-2179.8828,696.1923,53.8906,350.1999,30,150,25,50,29,150);
                case 
5SetSpawnInfo(playerid,6,248,-2173.5547,678.3575,55.1643,11.1934,30,150,25,50,29,150);
            }
            
SetPlayerSkin(playerid248);
            
SetPlayerColor(playeridcolor_BIKER);
        }
        case 
7//Rich
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,7,295,-2667.5515,906.6794,79.6682,153.4801,30,150,32,150,24,50);
                case 
1SetSpawnInfo(playerid,7,295,-2672.0000,928.3350,79.7031,312.8954,30,150,32,150,24,50);
                case 
2SetSpawnInfo(playerid,7,295,-2643.0881,934.8712,71.9531,169.5791,30,150,32,150,24,50);
                case 
3SetSpawnInfo(playerid,7,295,-2667.0095,890.7147,79.7031,15.6586,30,150,32,150,24,50);
                case 
4SetSpawnInfo(playerid,7,295,-2699.0244,919.0204,67.6009,247.8502,30,150,32,150,24,50);
                case 
5SetSpawnInfo(playerid,7,295,-2665.0984,866.3409,76.2734,79.2985,30,150,32,150,24,50);
            }
            
SetPlayerSkin(playerid295);
            
SetPlayerColor(playeridcolor_RICH);
        }
        case 
8//Farmers
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,8,159,-1058.2749,-1162.2968,128.8435,169.9164,29,150,31,150,16,8);
                case 
1SetSpawnInfo(playerid,8,159,-1062.4131,-1189.3451,129.2188,279.5842,29,150,31,150,16,8);
                case 
2SetSpawnInfo(playerid,8,159,-1036.6643,-1176.3632,129.2188,82.4956,29,150,31,150,16,8);
                case 
3SetSpawnInfo(playerid,8,159,-1024.8270,-1150.3081,129.2188,63.6955,29,150,31,150,16,8);
                case 
4SetSpawnInfo(playerid,8,159,-1070.8446,-1132.6522,129.2188,250.9748,29,150,31,150,16,8);
                case 
5:  SetSpawnInfo(playerid,8,159,-1070.8446,-1132.6522,129.2188,250.9748,29,150,31,150,16,8);
            }
            
SetPlayerSkin(playerid159);
            
SetPlayerColor(playeridcolor_FARMERS);
        }
        case 
9//Mechanic
        
{
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,9,50,-473.5201,-513.6721,25.0684,178.2461,31,150,24,20,27,100);
                case 
1SetSpawnInfo(playerid,9,50,-475.6059,-524.9758,25.5178,89.3053,31,150,24,20,27,100);
                case 
2SetSpawnInfo(playerid,9,50,-477.4657,-531.2911,25.5296,93.6920,31,150,24,20,27,100);
                case 
3SetSpawnInfo(playerid,9,50,-477.8717,-538.9334,25.5296,93.3787,31,150,24,20,27,100);
                case 
4SetSpawnInfo(playerid,9,50,-502.8699,-512.2277,25.5234,271.9569,31,150,24,20,27,100);
                case 
5SetSpawnInfo(playerid,9,50,-507.9384,-506.2292,25.5234,1.8847,31,150,24,20,27,100);
            }
            
SetPlayerSkin(playerid50);
            
SetPlayerColor(playeridcolor_MECHANIC);
        }
        case 
10:
        {
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,10,296,-2640.1396,1374.2184,7.1437,252.1212,31,150,24,20,27,100);
                case 
1SetSpawnInfo(playerid,10,296,-2650.6367,1377.7343,7.1873,281.2850,31,150,24,20,27,100);
                case 
2SetSpawnInfo(playerid,10,296,-2643.0452,1382.0310,7.1739,169.1104,31,150,24,20,27,100);
                case 
3SetSpawnInfo(playerid,10,296,-2633.2600,1382.8607,7.1810,193.2373,31,150,24,20,27,100);
                case 
4SetSpawnInfo(playerid,10,296,-2628.6982,1403.3459,7.0938,264.0513,31,150,24,20,27,100);
                case 
5SetSpawnInfo(playerid,10,296,-2618.9673,1414.7338,7.0938,242.4544,31,150,24,20,27,100);
            }
              
SetPlayerSkin(playerid296);
              
SetPlayerColor(playeridcolor_PIMP);
        }
        case 
11:
        {
            switch(
random(5))
            {
                case 
0SetSpawnInfo(playerid,11,287,-1335.4381,506.1993,11.1953,83.7755,30,150,25,50,29,150);
                case 
1SetSpawnInfo(playerid,11,287,-1343.6302,495.4990,11.2027,352.2811,30,150,25,50,29,150);
                case 
2SetSpawnInfo(playerid,11,287,-1345.2030,501.2993,18.2344,353.2445,30,150,25,50,29,150);
                case 
3SetSpawnInfo(playerid,11,287,-1319.4777,493.7184,18.2344,279.8277,30,150,25,50,29,150);
                case 
4SetSpawnInfo(playerid,11,287,-1324.1310,491.2367,22.5156,137.0422,30,150,25,50,29,150);
                case 
5SetSpawnInfo(playerid,11,287,-1336.6809,449.3867,7.1875,278.9795,30,150,25,50,29,150);
            }
            
SetPlayerSkin(playerid287);
            
SetPlayerColor(playeridcolor_SOLDADOS);
        }
    }
    
GameTextForPlayer(playerid"~g~Skin Changed!"30003);
    return 
1;

Reply
#3

Jesus, in this situation I'd be bordering to some other method.

Both for ease of visual understanding, and for code reasons as well.


These should be an array or enum of some sort, so that instead of having the second switch, in each faction/team, you could just use random, and address the array, rather than having these massive blocks of checks that do singular things.


Having them all in arrays and stashed somewhere, will make them easier to add to, if you use sizeof in the picking of the amount of spawns that the class itself has.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)