14.05.2018, 09:24
It took me a while
Have in mind that, in most cases, you're doing it wrong if you repeat the same code
Have in mind that, in most cases, you're doing it wrong if you repeat the same code
PHP код:
forward ClassSelection(playerid, listitem);
public ClassSelection(playerid, listitem)
{
switch(listitem)
{
case 0: // Negros
{
switch(random(7))
{
case 0: SetPlayerSkin(playerid, 21);
case 1: SetPlayerSkin(playerid, 19);
case 2: SetPlayerSkin(playerid, 183);
case 3: SetPlayerSkin(playerid, 104);
case 4: SetPlayerSkin(playerid, 28);
case 5: SetPlayerSkin(playerid, 22);
case 6: SetPlayerSkin(playerid, 190);
case 7: SetPlayerSkin(playerid, 195);
}
SetPlayerPos(playerid, -2636.9077,260.5389,4.3281);
GivePlayerWeapon(playerid, 30, 150);
GivePlayerWeapon(playerid, 25, 50);
GivePlayerWeapon(playerid, 29, 150);
SetPlayerColor(playerid, color_NEGROS);
}
case 1: // Civiles
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,1,2,-1762.0461,960.5403,24.8828,171.4048,26,100,29,150,24,20);
case 1: SetSpawnInfo(playerid,1,2,-1771.2639,961.1591,24.8828,167.9581,26,100,29,150,24,20);
case 2: SetSpawnInfo(playerid,1,2,-1751.0995,961.6115,24.8828,176.7314,26,100,29,150,24,20);
case 3: SetSpawnInfo(playerid,1,2,-1739.0233,961.1733,24.8828,171.0913,26,100,29,150,24,20);
case 4: SetSpawnInfo(playerid,1,2,-1743.8237,946.1083,24.8828,15.3633,26,100,29,150,24,20);
case 5: SetSpawnInfo(playerid,1,2,-1764.9819,945.7482,24.8828,31.9701,26,100,29,150,24,20);
}
SetPlayerSkin(playerid, 2);
SetPlayerColor(playerid, color_CIVILES);
}
case 2: // Mafia
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,2,124,-2454.6692,139.8220,34.9609,313.0271,30,150,25,50,29,150);
case 1: SetSpawnInfo(playerid,2,124,-2465.1528,158.7457,35.1797,260.3865,30,150,25,50,29,150);
case 2: SetSpawnInfo(playerid,2,124,-2449.1057,187.0281,35.1094,183.6425,30,150,25,50,29,150);
case 3: SetSpawnInfo(playerid,2,124,-2443.7385,157.4708,35.1328,80.8915,30,150,25,50,29,150);
case 4: SetSpawnInfo(playerid,2,124,-2479.0303,103.7202,35.1829,162.0456,30,150,25,50,29,150);
case 5: SetSpawnInfo(playerid,2,124,-2490.6843,128.5919,25.8672,82.4817,30,150,25,50,29,150);
}
SetPlayerSkin(playerid, 124);
SetPlayerColor(playerid, color_MAFIA);
}
case 3: // Nang
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,3,122,-1678.2971,1359.7749,6.8045,314.8831,30,150,32,150,24,50);
case 1: SetSpawnInfo(playerid,3,122,-1683.0354,1373.6479,7.1797,212.4220,30,150,32,150,24,50);
case 2: SetSpawnInfo(playerid,3,122,-1672.4862,1389.7667,9.8047,217.4589,30,150,32,150,24,50);
case 3: SetSpawnInfo(playerid,3,122,-1637.9294,1393.6322,9.8047,131.9175,30,150,32,150,24,50);
case 4: SetSpawnInfo(playerid,3,122,-1622.2827,1403.1455,7.1826,86.1703,30,150,32,150,24,50);
case 5: SetSpawnInfo(playerid,3,122,-1653.6068,1412.7996,7.1875,219.0248,30,150,32,150,24,50);
}
SetPlayerSkin(playerid, 122);
SetPlayerColor(playerid, color_NANG);
}
case 4: // Swat
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,4,285,-1635.0077,665.8105,7.1875,264.2244,29,150,31,150,16,8);
case 1: SetSpawnInfo(playerid,4,285,-1616.1135,678.0463,7.1875,178.0571,29,150,31,150,16,8);
case 2: SetSpawnInfo(playerid,4,285,-1568.1500,723.5207,-4.9063,84.0327,29,150,31,150,16,8);
case 3: SetSpawnInfo(playerid,4,285,-1668.7944,699.7700,30.6016,77.0743,29,150,31,150,16,8);
case 4: SetSpawnInfo(playerid,4,285,-1582.5112,678.0520,7.1875,198.7212,29,150,31,150,16,8);
case 5: SetSpawnInfo(playerid,4,285,-1637.2410,670.7408,7.1875,274.7658,29,150,31,150,16,8);
}
SetPlayerSkin(playerid, 285);
SetPlayerColor(playerid, color_SWAT);
}
case 5: //Surenos
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,5,108,-2123.0313,-212.4085,34.9448,103.0335,31,150,24,20,27,100);
case 1: SetSpawnInfo(playerid,5,108,-2184.8193,-238.6618,36.5220,347.7257,31,150,24,20,27,100);
case 2: SetSpawnInfo(playerid,5,108,-2178.6587,-214.1436,36.5156,276.2614,31,150,24,20,27,100);
case 3: SetSpawnInfo(playerid,5,108,-2135.8870,-257.6828,35.3203,262.7646,31,150,24,20,27,100);
case 4: SetSpawnInfo(playerid,5,108,-2124.7539,-270.8351,35.3203,357.3689,31,150,24,20,27,100);
case 5: SetSpawnInfo(playerid,5,108,-2127.8025,-196.0021,35.3203,168.8363,31,150,24,20,27,100);
}
SetPlayerSkin(playerid, 108);
SetPlayerColor(playerid, color_SURENOS);
}
case 6: //Biker
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,6,248,-2180.8606,706.7700,53.8906,188.5527,30,150,25,50,29,150);
case 1: SetSpawnInfo(playerid,6,248,-2173.2168,708.5998,53.8906,79.9423,30,150,25,50,29,150);
case 2: SetSpawnInfo(playerid,6,248,-2181.6575,710.5045,53.8906,186.0117,30,150,25,50,29,150);
case 3: SetSpawnInfo(playerid,6,248,-2185.4250,713.7176,53.8976,266.2257,30,150,25,50,29,150);
case 4: SetSpawnInfo(playerid,6,248,-2179.8828,696.1923,53.8906,350.1999,30,150,25,50,29,150);
case 5: SetSpawnInfo(playerid,6,248,-2173.5547,678.3575,55.1643,11.1934,30,150,25,50,29,150);
}
SetPlayerSkin(playerid, 248);
SetPlayerColor(playerid, color_BIKER);
}
case 7: //Rich
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,7,295,-2667.5515,906.6794,79.6682,153.4801,30,150,32,150,24,50);
case 1: SetSpawnInfo(playerid,7,295,-2672.0000,928.3350,79.7031,312.8954,30,150,32,150,24,50);
case 2: SetSpawnInfo(playerid,7,295,-2643.0881,934.8712,71.9531,169.5791,30,150,32,150,24,50);
case 3: SetSpawnInfo(playerid,7,295,-2667.0095,890.7147,79.7031,15.6586,30,150,32,150,24,50);
case 4: SetSpawnInfo(playerid,7,295,-2699.0244,919.0204,67.6009,247.8502,30,150,32,150,24,50);
case 5: SetSpawnInfo(playerid,7,295,-2665.0984,866.3409,76.2734,79.2985,30,150,32,150,24,50);
}
SetPlayerSkin(playerid, 295);
SetPlayerColor(playerid, color_RICH);
}
case 8: //Farmers
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,8,159,-1058.2749,-1162.2968,128.8435,169.9164,29,150,31,150,16,8);
case 1: SetSpawnInfo(playerid,8,159,-1062.4131,-1189.3451,129.2188,279.5842,29,150,31,150,16,8);
case 2: SetSpawnInfo(playerid,8,159,-1036.6643,-1176.3632,129.2188,82.4956,29,150,31,150,16,8);
case 3: SetSpawnInfo(playerid,8,159,-1024.8270,-1150.3081,129.2188,63.6955,29,150,31,150,16,8);
case 4: SetSpawnInfo(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(playerid, 159);
SetPlayerColor(playerid, color_FARMERS);
}
case 9: //Mechanic
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,9,50,-473.5201,-513.6721,25.0684,178.2461,31,150,24,20,27,100);
case 1: SetSpawnInfo(playerid,9,50,-475.6059,-524.9758,25.5178,89.3053,31,150,24,20,27,100);
case 2: SetSpawnInfo(playerid,9,50,-477.4657,-531.2911,25.5296,93.6920,31,150,24,20,27,100);
case 3: SetSpawnInfo(playerid,9,50,-477.8717,-538.9334,25.5296,93.3787,31,150,24,20,27,100);
case 4: SetSpawnInfo(playerid,9,50,-502.8699,-512.2277,25.5234,271.9569,31,150,24,20,27,100);
case 5: SetSpawnInfo(playerid,9,50,-507.9384,-506.2292,25.5234,1.8847,31,150,24,20,27,100);
}
SetPlayerSkin(playerid, 50);
SetPlayerColor(playerid, color_MECHANIC);
}
case 10:
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,10,296,-2640.1396,1374.2184,7.1437,252.1212,31,150,24,20,27,100);
case 1: SetSpawnInfo(playerid,10,296,-2650.6367,1377.7343,7.1873,281.2850,31,150,24,20,27,100);
case 2: SetSpawnInfo(playerid,10,296,-2643.0452,1382.0310,7.1739,169.1104,31,150,24,20,27,100);
case 3: SetSpawnInfo(playerid,10,296,-2633.2600,1382.8607,7.1810,193.2373,31,150,24,20,27,100);
case 4: SetSpawnInfo(playerid,10,296,-2628.6982,1403.3459,7.0938,264.0513,31,150,24,20,27,100);
case 5: SetSpawnInfo(playerid,10,296,-2618.9673,1414.7338,7.0938,242.4544,31,150,24,20,27,100);
}
SetPlayerSkin(playerid, 296);
SetPlayerColor(playerid, color_PIMP);
}
case 11:
{
switch(random(5))
{
case 0: SetSpawnInfo(playerid,11,287,-1335.4381,506.1993,11.1953,83.7755,30,150,25,50,29,150);
case 1: SetSpawnInfo(playerid,11,287,-1343.6302,495.4990,11.2027,352.2811,30,150,25,50,29,150);
case 2: SetSpawnInfo(playerid,11,287,-1345.2030,501.2993,18.2344,353.2445,30,150,25,50,29,150);
case 3: SetSpawnInfo(playerid,11,287,-1319.4777,493.7184,18.2344,279.8277,30,150,25,50,29,150);
case 4: SetSpawnInfo(playerid,11,287,-1324.1310,491.2367,22.5156,137.0422,30,150,25,50,29,150);
case 5: SetSpawnInfo(playerid,11,287,-1336.6809,449.3867,7.1875,278.9795,30,150,25,50,29,150);
}
SetPlayerSkin(playerid, 287);
SetPlayerColor(playerid, color_SOLDADOS);
}
}
GameTextForPlayer(playerid, "~g~Skin Changed!", 3000, 3);
return 1;
}