Race tournament crash.
#1

Hello.

I made race tournament with 200 cp, and i have only one problem - when someone is joining - crash. Maybe something going wrong with new bool:IsRaceRunning = false; I tried to fix this 19999999 times. 0 warrings 0 errors. Thanks for help!



Код:
//________________San Fierro Oldschool Race V.1.0 by CREED _____________________


//______________________________________________________________________________
#include <a_samp>
#include <foreach.inc>
#define SCM SendClientMessage
#define DIALOG_INFO 1
//______________________________________________________________________________
new TTA;
new Text:TTT;
new Kontrolpunkts[MAX_PLAYERS];
forward Atskaite();
//______________________________________________________________________________
new Player_CheckPoint[MAX_PLAYERS];
new bool:IsRaceRunning = false;
new Uzvaretajs[MAX_PLAYER_NAME];
new stringwin[64];
//______________________________________________________________________________
new Float:CheckPoints[201][3] =
{
{-2127.3611,-81.2161,35.1019},
{-2167.1638,-71.8486,34.9774},
{-2256.0537,-191.7249,34.9743},
{-2204.0200,-466.3755,49.3204},
{-2226.0217,-740.3702,64.3937},
{-2312.0801,-782.2291,90.6318},
{-2422.8140,-609.5429,132.3662},
{-2628.3250,-494.8151,69.9621},
{-2355.0166,-460.1673,80.0940},
{-2405.0300,-372.5957,74.1240},
{-2677.2102,-433.3191,30.8330},
{-2790.6455,-483.1252,7.1875},
{-2864.6570,-746.6817,6.8411},
{-2895.7124,-1108.7319,9.2954},
{-2928.5608,-1504.1327,10.4927},
{-2866.3599,-1822.5652,37.3526},
{-2681.6980,-2064.2900,34.7385},
{-2547.6660,-2191.5115,29.4839},
{-2412.7429,-2281.7610,14.3640},
{-2190.0144,-2164.8621,46.1718},
{-2097.9290,-2051.1150,63.5353},
{-2007.0161,-1882.3625,44.1522},
{-1810.4762,-1716.8638,28.9074},
{-1593.6357,-1609.6371,36.0616},
{-1277.4215,-1716.4047,45.7401},
{-1168.3938,-1883.8439,77.4653},
{-976.4849,-1906.2766,79.9545},
{-1090.4429,-2125.5974,39.1594},
{-1128.0782,-2230.0486,32.9695},
{-1167.0088,-2298.0681,36.7703},
{-1179.1106,-2354.8384,19.5039},
{-1005.9504,-2372.6809,63.6573},
{-940.9874,-2352.9678,59.0616},
{-960.9373,-2262.2205,49.7479},
{-939.2848,-2174.0791,34.6017},
{-807.5222,-2168.4670,21.8873},
{-819.5229,-2049.3230,25.0821},
{-812.6588,-1902.4973,9.9517},
{-685.2260,-1853.8949,14.2130},
{-671.6121,-1926.8408,11.2027},
{-664.4790,-2022.0352,24.7611},
{-571.6180,-2030.1292,48.6166},
{-459.6981,-2020.1434,45.6988},
{-435.6468,-1922.0863,6.5514},
{-324.8900,-1909.4700,11.9869},
{-303.4461,-1997.5537,20.4338},
{-365.8625,-2007.5195,28.0013},
{-361.2732,-1852.4049,23.9070},
{-292.2771,-1679.8589,14.7232},
{-359.0790,-1670.1654,27.8183},
{-507.9037,-1650.7599,10.1570},
{-477.8809,-1552.2300,10.6049},
{-459.9614,-1412.6991,17.9576},
{-341.8094,-1360.8684,13.9030},
{-321.8217,-1244.8286,22.2482},
{-214.7607,-1134.4092,3.3450},
{-147.4416,-1054.7814,1.6626},
{-192.7417,-998.0585,9.1412},
{-277.1133,-1043.6388,39.1225},
{-358.6667,-1112.5348,68.8228},
{-413.1138,-1071.7808,56.9627},
{-397.3706,-1060.9348,59.2584},
{-362.5703,-1066.5402,59.1029},
{-345.5822,-1067.1564,59.1971},
{-339.2063,-1035.0875,59.0320},
{-384.2148,-1033.2999,58.7000},
{-383.4210,-1055.1774,58.7020},
{-413.9952,-1068.6039,56.4126},
{-435.7881,-1031.5723,44.2671},
{-480.6108,-991.7987,24.8272},
{-356.7685,-781.6960,29.6735},
{-367.5876,-726.8159,24.9966},
{-433.9029,-715.7938,24.9279},
{-549.5139,-713.7789,29.1531},
{-631.6091,-741.3096,61.9722},
{-673.2056,-816.7361,97.9294},
{-725.0118,-869.9240,112.8702},
{-813.8594,-950.1165,104.1579},
{-834.6168,-1013.2775,84.8459},
{-865.7889,-1057.3823,91.4030},
{-883.2406,-1122.5631,98.6997},
{-974.3464,-1029.0972,95.4951},
{-1102.3710,-897.3944,75.8807},
{-1250.8528,-732.6218,63.2340},
{-1286.9060,-583.7806,13.9502},
{-1313.9565,-415.9547,13.9512},
{-1362.5728,-402.4512,9.0086},
{-1414.8741,-399.3861,5.6545},
{-1467.6624,-451.0681,5.6581},
{-1533.9045,-424.5375,5.6603},
{-1585.3634,-346.9289,5.8011},
{-1564.8356,-328.8784,5.8044},
{-1549.2542,-298.9672,5.8006},
{-1510.7576,-285.1115,5.6673},
{-1525.0929,-216.6704,13.9542},
{-1357.7714,-95.0713,13.9523},
{-1247.0826,-19.2195,13.9524},
{-1204.3962,55.9691,13.9436},
{-1229.8588,79.8792,10.9776},
{-1266.9054,117.2169,3.7116},
{-1362.5376,121.0162,2.2493},
{-1394.7461,81.3261,2.3008},
{-1412.4135,-0.1881,5.3762},
{-1426.1207,-31.3046,5.8033},
{-1433.8015,35.1998,5.8036},
{-1465.9915,24.6506,5.8065},
{-1465.9542,-51.7139,5.8073},
{-1441.0415,-67.9761,5.8033},
{-1431.8143,-133.3227,5.8035},
{-1392.4335,-135.7662,5.8028},
{-1347.0195,-145.6467,5.8010},
{-1350.1038,-239.6033,5.8044},
{-1410.2061,-238.9213,5.8064},
{-1417.6996,-293.1311,5.8024},
{-1446.4596,-304.1535,6.1305},
{-1585.1047,-373.4690,11.8006},
{-1562.6351,-445.0473,5.8038},
{-1621.3734,-507.7217,8.9508},
{-1751.5109,-576.6330,16.1389},
{-1815.9375,-575.7170,16.1375},
{-1812.7811,-405.5818,15.7182},
{-1800.4565,-241.8144,18.0303},
{-1835.4667,-235.6270,18.0299},
{-1838.3273,-177.6936,9.0679},
{-1883.1188,-176.9019,11.7931},
{-1876.1696,-111.4300,12.2707},
{-1963.5538,-65.6279,25.5292},
{-2010.3182,-68.7831,34.9739},
{-2084.1423,-68.6555,34.9778},
{-2087.1992,27.9367,34.9720},
{-2165.1489,32.5387,34.9712},
{-2160.7324,90.4825,34.9760},
{-2124.9973,107.3575,34.9747},
{-2007.3486,109.8947,27.3413},
{-2005.4476,222.8557,27.6368},
{-1937.1797,227.3755,33.9689},
{-1908.7439,266.9192,40.8467},
{-1946.1221,271.4558,40.8506},
{-1948.7950,258.7030,40.8517},
{-1926.2030,257.8007,40.8475},
{-1940.1615,243.3224,40.8492},
{-1973.8243,286.9677,34.9753},
{-2004.4998,337.4186,34.8162},
{-1948.6084,342.2987,33.1255},
{-1865.1149,410.3755,16.8170},
{-1787.2656,345.6392,15.0228},
{-1748.5587,307.7606,6.8353},
{-1693.0649,357.4286,6.8342},
{-1696.9973,398.9058,6.9835},
{-1670.7275,431.5795,6.9830},
{-1638.8013,429.4260,6.8968},
{-1563.8892,492.5101,6.8348},
{-1529.8419,481.6193,6.9859},
{-1492.5829,466.6767,6.9913},
{-1364.6967,465.2750,6.9913},
{-1320.6873,480.7963,6.9074},
{-1312.1776,452.7699,6.9910},
{-1339.0790,435.9230,6.9872},
{-1467.1621,427.2525,6.9931},
{-1465.7332,406.6519,6.9917},
{-1432.0353,400.0866,6.9946},
{-1422.2781,414.6501,6.9897},
{-1367.3931,416.3506,6.9904},
{-1329.9749,408.8224,6.9885},
{-1415.4410,400.4540,6.9942},
{-1465.8026,373.9606,6.9901},
{-1381.6720,344.8728,6.9911},
{-1331.8318,332.8907,6.9915},
{-1438.9225,288.2365,7.1871},
{-1587.9081,275.7867,6.9912},
{-1611.0448,363.4470,6.9913},
{-1530.4755,481.7317,6.9854},
{-1525.3981,564.1080,6.9801},
{-1559.6079,731.6521,6.8372},
{-1654.1924,733.6955,16.2582},
{-1659.6783,834.6777,19.4642},
{-1628.2323,865.6390,7.6802},
{-1629.7916,919.8328,11.6999},
{-1669.5573,933.3936,24.5446},
{-1794.2301,933.6034,24.5447},
{-1794.8179,993.6102,24.5354},
{-1777.4398,992.6157,23.9262},
{-1695.3855,984.4717,17.3888},
{-1689.8918,1053.6022,17.3882},
{-1731.5063,1055.6747,17.3866},
{-1738.9816,985.1688,17.3934},
{-1784.9344,1001.7115,24.5750},
{-1793.0341,1105.2789,45.0999},
{-1881.0481,1106.3141,45.0930},
{-1882.9113,1175.2848,45.0995},
{-2038.5366,1176.8658,45.1006},
{-2178.4189,1176.3341,55.3818},
{-2262.6514,1178.7715,55.3813},
{-2464.0371,1205.6385,34.8881},
{-2553.1528,1194.6372,44.7095},
{-2634.5984,1207.7484,54.4763},
{-2668.3367,1198.7118,55.2321},
{-2684.8137,1256.2225,55.2333},
{-2685.4795,1381.5015,55.2307},
{-2684.3477,1636.1282,65.5867},
{-2681.5042,2144.8013,55.6156}
};
//------------------------------------------------------------------------------
enum e_spawns
{
	Float:spawnPos[3],
	spawnUsed
}
new spawns[][e_spawns] =
{
    {{-2136.9189, -228.4620, 34.9416},0},
    {{-2130.2085, -228.4513, 34.9416},0},
    {{-2123.8501, -228.4545, 34.9416},0},
    {{-2117.4841, -228.4520, 34.9416},0},
    {{-2110.6528, -228.4764, 34.9416},0},
    {{-2103.8652, -228.4486, 34.9416},0},
    {{-2098.3752, -228.4544, 34.9416},0}
};
forward spawnAvailable(spawn);
public spawnAvailable(spawn)
{
    spawns[spawn][spawnUsed] = 0;
}





//------------------------------------------------------------------------------
    main()
    {
	print("\n---------------------------------------");
	print("none");
	print("---------------------------------------\n");
    }
//______________________________________________________________________________
public OnPlayerConnect(playerid)
{
    RemoveBuildingForPlayer(playerid, 11010, -2113.3203, -186.7969, 40.2813, 0.25);
    RemoveBuildingForPlayer(playerid, 11048, -2113.3203, -186.7969, 40.2813, 0.25);
    RemoveBuildingForPlayer(playerid, 11088, -2166.8750, -236.5156, 40.8594, 0.25);
    RemoveBuildingForPlayer(playerid, 11091, -2133.5547, -132.7031, 36.1328, 0.25);
    RemoveBuildingForPlayer(playerid, 11271, -2127.5469, -269.9609, 41.0000, 0.25);
    RemoveBuildingForPlayer(playerid, 11282, -2166.8750, -236.5156, 40.8594, 0.25);
    RemoveBuildingForPlayer(playerid, 11376, -2144.3516, -132.9609, 38.3359, 0.25);
    RemoveBuildingForPlayer(playerid, 11081, -2127.5469, -269.9609, 41.0000, 0.25);
    RemoveBuildingForPlayer(playerid, 1278, -2097.6797, -178.2344, 48.3516, 0.25);
    RemoveBuildingForPlayer(playerid, 11011, -2144.3516, -132.9609, 38.3359, 0.25);
    RemoveBuildingForPlayer(playerid, 11009, -2128.5391, -142.8438, 39.1406, 0.25);
    RemoveBuildingForPlayer(playerid, 1278, -2137.6172, -110.9375, 48.3516, 0.25);
    for(new i;i<MAX_PLAYERS;i++)
    {
    if(Player_CheckPoint[playerid] == 0)
    {
      SetPlayerRaceCheckpoint(playerid,1,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
    }
    }
	new name[MAX_PLAYER_NAME], string[100];
    GetPlayerName(playerid, name, sizeof(name));
    format(string, sizeof(string), "- %s pievienojas turnоram", name);
    SendClientMessageToAll(0xFFFF29FF, string);
    return 1;
}
//______________________________________________________________________________
public OnGameModeInit()
{
    ShowNameTags(1);
	SetNameTagDrawDistance(90.0);
	SetWorldTime(6);
    SetTimer("AR", 1000, 1);
    ShowPlayerMarkers(PLAYER_MARKERS_MODE_GLOBAL);
    SetWeather(18);
    EnableStuntBonusForAll(0);
    SetWorldTime(12);
    SetGameModeText("Oldschool Race V1.0");
//------------------------------------------------------------------------------
	AddPlayerClass(258,-2133.5640,178.0033,42.2500,80.8911, 0, 0, 0, 0, 0, 0);
	AddPlayerClass(259,-2133.5640,178.0033,42.2500,80.8911, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(88,-2133.5640,178.0033,42.2500,80.8911, 0, 0, 0, 0, 0, 0);
    AddPlayerClass(196,-2133.5640,178.0033,42.2500,80.8911, 0, 0, 0, 0, 0, 0);
//------------------------------------------------------------------------------
	CreateObject(19459, -2133.48584, -225.61371, 32.64374,   0.00000, 0.00000, 90.00000);
    CreateObject(19459, -2123.85889, -225.60905, 32.64374,   0.00000, 0.00000, 90.00000);
    CreateObject(19459, -2114.24731, -225.60178, 32.64374,   0.00000, 0.00000, 90.00000);
    CreateObject(19459, -2104.61646, -225.60454, 32.64374,   0.00000, 0.00000, 90.00000);
    CreateObject(19459, -2095.03174, -225.60416, 32.64374,   0.00000, 0.00000, 90.00000);
    CreateObject(19425, -2123.78589, -80.75489, 34.26825,   0.00000, 0.00000, 0.00000);
    CreateObject(19425, -2127.05078, -80.74914, 34.26825,   0.00000, 0.00000, 0.00000);
    CreateObject(19425, -2130.34717, -80.74873, 34.26825,   0.00000, 0.00000, 0.00000);
    CreateObject(19425, -2133.64917, -80.74784, 34.26825,   0.00000, 0.00000, 0.00000);
    CreateObject(978, -2119.14624, -65.16209, 34.94985,   0.00000, 0.00000, 90.00000);
    CreateObject(978, -2119.16455, -75.35887, 34.94985,   0.00000, 0.00000, 90.00000);
    CreateObject(978, -2177.39551, -75.63031, 34.90987,   0.00000, 0.00000, -90.00000);
    CreateObject(978, -2177.44580, -64.80650, 34.90987,   0.00000, 0.00000, -90.00000);
    CreateObject(978, -2172.71191, -60.28016, 34.90990,   0.00000, 0.00000, 180.00000);
    CreateObject(19624, -2134.62891, 177.84364, 41.34276,   90.00000, 0.00000, -294.24017);
    CreateObject(1711, -2134.22021, 178.19138, 41.24634,   0.00000, 0.00000, 90.12001);
    CreateObject(11737, -2133.37012, 178.46640, 41.25051,   0.00000, 0.00000, -79.56001);
    CreateObject(11103, -2136.34546, 181.36627, 43.27638,   0.00000, 0.00000, 0.00000);
    CreateObject(11103, -2136.38208, 176.43892, 43.27638,   0.00000, 0.00000, 0.00000);
    CreateObject(11103, -2136.40845, 171.73932, 43.27638,   0.00000, 0.00000, 0.00000);
    CreateObject(18749, -2136.03857, 179.25723, 42.95940,   0.00000, 0.00000, 90.00000);
    CreateObject(19631, -2135.87183, 183.63257, 41.57997,   70.00000, 90.00000, 90.00000);
    return 1;
}
//______________________________________________________________________________
public OnPlayerRequestClass(playerid, classid)
{
	SetPlayerPos(playerid, -2133.5640,178.0033,42.2500);
	SetPlayerCameraPos(playerid, -2129.2332,174.2672,43.1049);
    SetPlayerCameraLookAt(playerid, -2134.1101,177.9363,42.2500);
    SetPlayerInterior(playerid, 0);
    SetPlayerFacingAngle(playerid, 80.8911);
    ApplyAnimation( playerid, "HAIRCUTS", "BRB_Beard_01", 3.1, 0, 1, 1, 1, 1 );
    return 1;
}
//______________________________________________________________________________
public OnPlayerExitVehicle(playerid, vehicleid)
{
    new currentveh;
    currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    return 1;
}
//______________________________________________________________________________
public OnPlayerSpawn(playerid)
{
    ShowPlayerDialog(playerid, DIALOG_INFO, DIALOG_STYLE_MSGBOX, "      {B35900}San Fierro Oldschool Race V1.0 ", "- {B35900}/car{FFFFFF} lai nospawnotu transportu!\n- {B35900}/repair{FFFFFF} lai salabotu transportu! \n- {B35900}/flip{FFFFFF} lai atgrieztu braukрanas stвvoklо! \n- {B35900}/cp{FFFFFF} lai teleportetos uz pзdзjo kontrolpunktu!\n\n            Lai veicas!", "Labi", "");
	if(Player_CheckPoint[playerid] == 0)
	{
		new rand = random(sizeof(spawns));
		while(spawns[rand][spawnUsed])
		rand = random(sizeof(spawns));
		spawns[rand][spawnUsed] = 1;
        new Car = CreateVehicle(542,spawns[rand][spawnPos][0],spawns[rand][spawnPos][1],spawns[rand][spawnPos][2],0,123,123,0);
		SetVehicleNumberPlate(Car, "{AA0909}PARTY");
        SCM(playerid, 0xB35900FF,"[INFO]:{FFFFFF}Gaidiet turnоra startu!");
        for(new i;i<MAX_PLAYERS;i++)
		{
			PutPlayerInVehicle(playerid,Car,0);
			TogglePlayerControllable(i,0);
			SetPlayerCameraPos(playerid, -2135.1699,-201.5379,51.7574);
			SetPlayerCameraLookAt(playerid, -2117.0093,-228.5099,35.2162);
        }
	}
	else
	{
	SetPlayerPos(playerid,CheckPoints[Player_CheckPoint[playerid]-1][0],CheckPoints[Player_CheckPoint[playerid]-1][1],CheckPoints[Player_CheckPoint[playerid]-1][2]);
    SCM(playerid, 0xB35900FF,"[INFO]:{FFFFFF}Jыs teleportзjвties uz pзdзjo sasniegto kontrolpunktu!");
    SetPlayerRaceCheckpoint(playerid,0,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]+1][0],CheckPoints[Player_CheckPoint[playerid]+1][1],CheckPoints[Player_CheckPoint[playerid]+1][2],3.7);
    return 1;
	}
    if(TTA != 0)
    {
            TogglePlayerControllable(playerid,1);
	        SetCameraBehindPlayer(playerid);
	        SCM(playerid, 0xAA0909FF,"[INFO]:{FFFFFF}Turnоrs jau ir sвcies! Jыs varat droрi doties trasз!");
            new rand = random(sizeof(spawns));
	        while(spawns[rand][spawnUsed])
        	rand = random(sizeof(spawns));
	        spawns[rand][spawnUsed] = 1;
            new Car = CreateVehicle(542,spawns[rand][spawnPos][0],spawns[rand][spawnPos][1],spawns[rand][spawnPos][2],0,123,123,0);
	        SetVehicleNumberPlate(Car, "{AA0909}PARTY");
	        PutPlayerInVehicle(playerid,Car,0);
	}
    return 1;
	        
}
//______________________________________________________________________________
public OnPlayerCommandText(playerid, cmdtext[])
{
   if(strcmp(cmdtext, "/ton", true) == 0)
   {
    TTA = 10;
    PlayerPlaySound(playerid, 1190, 0.0, 0.0, 10.0);
    SCM(playerid, 0xAA0909FF,"[INFO]:{FFFFFF}Oldschool Race Turnоrs sвksies pзc 1min.");
    TTT = TextDrawCreate(2.0, 230, "00:00");
    TextDrawColor(TTT,0xFF0000AE);
    SetTimer("Atskaite", 1000, 1);
    return 1;
   }
   if(strcmp(cmdtext, "/repair", true) == 0)
   {
   RepairVehicle(GetPlayerVehicleID(playerid));
   SCM(playerid, 0xB35900FF,"[INFO]:{FFFFFF}Transports salabots!");
   return 1;
   }
   if(strcmp(cmdtext, "/flip", true) == 0)
   {
   new currentveh;
   new Float:angle;
   currentveh = GetPlayerVehicleID(playerid);
   GetVehicleZAngle(currentveh, angle);
   SetVehicleZAngle(currentveh, angle);
   SCM(playerid, 0xB35900FF,"[INFO]:{FFFFFF}Jыsu transports atgriezts braukрanas stвvoklо!");
   return 1;
   }
   if(strcmp(cmdtext, "/car", true) == 0)
   {
      if(IsPlayerInAnyVehicle(playerid))
	  {
      SCM(playerid, 0xAA0909FF,"[INFO]:{FFFFFF}Jus jau atrodaties maроnв!");
	  }
	  if(!IsPlayerInAnyVehicle(playerid))
      {
	  new Float:pos[4];
      GetPlayerPos(playerid, pos[0], pos[1], pos[2]);
      GetPlayerFacingAngle(playerid, pos[3]);
      new Car = CreateVehicle(542, pos[0], pos[1], pos[2], pos[3], 123, 123, 1200);
      SetVehicleNumberPlate(Car, "{AA0909}PARTY");
      PutPlayerInVehicle(playerid, Car, 0);
      SCM(playerid, 0xB35900FF,"[INFO]:{FFFFFF}Transports nospawnots!");
      }
	  return 1;
   }
   if(strcmp(cmdtext, "/cp", true) == 0)
   {
    if(Player_CheckPoint[playerid] > 0)
     {
       SetPlayerPos(playerid,CheckPoints[Player_CheckPoint[playerid]-1][0],CheckPoints[Player_CheckPoint[playerid]-1][1],CheckPoints[Player_CheckPoint[playerid]-1][2]);
       SCM(playerid, 0xB35900FF,"[INFO]:{FFFFFF}Jыs teleportзjвties uz pзdзjo sasniegto kontrolpunktu!");
     }
     else
     {
       SCM(playerid, 0xAA0909FF,"[INFO]:{FFFFFF}Jыs neesat sasniedzis nevienu kontrolpunktu!");
       return 1;
       }
   }
   return 1;
}

//______________________________________________________________________________
public OnPlayerEnterRaceCheckpoint(playerid)
{
        new string[256];
        Kontrolpunkts[playerid]++;
    	format(string, sizeof(string), "Kontrolpunkts: %d/201", Kontrolpunkts[playerid]);
        for(new i;i<MAX_PLAYERS;i++)
        {
        PlayerPlaySound(playerid, 1137, 0.0, 0.0, 10.0);
       	if(IsRaceRunning == true) { Player_CheckPoint[playerid]++; }
        if(Player_CheckPoint[playerid] < 200 && IsRaceRunning == true)
        {
        DisablePlayerRaceCheckpoint(playerid);
        SetPlayerRaceCheckpoint(playerid,0,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]+1][0],CheckPoints[Player_CheckPoint[playerid]+1][1],CheckPoints[Player_CheckPoint[playerid]+1][2],3.7);
		return 1;
        }
        if(Player_CheckPoint[playerid] == 200 && IsRaceRunning == true)
        {
        DisablePlayerRaceCheckpoint(playerid);
        SetPlayerRaceCheckpoint(playerid,1,CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],CheckPoints[Player_CheckPoint[playerid]][0],CheckPoints[Player_CheckPoint[playerid]][1],CheckPoints[Player_CheckPoint[playerid]][2],20.0);
		return 1;
        }
        if(Player_CheckPoint[playerid] == 201 && IsRaceRunning == true)
        {
        DisablePlayerRaceCheckpoint(playerid);
        }
        static place;
        place++;
        GetPlayerName(playerid,Uzvaretajs,sizeof(Uzvaretajs));
        format(stringwin, sizeof(stringwin), "%s sasniedza pedejo kontrolpunktu!    [ %d %s ]", Uzvaretajs, place, (place == 1) ?  ("Vieta") : (place == 2) ? ("Vieta"):(place == 3) ?  ("Vieta") : (place == 4) ? ("Vieta"):("th"));
        SendClientMessageToAll(0x00FF83FF, stringwin);
        new currentveh;
        currentveh = GetPlayerVehicleID(playerid);
        DestroyVehicle(currentveh);
        SetPlayerCameraPos(playerid, -2673.4878,2167.2710,61.5987);
        SetPlayerCameraLookAt(playerid, -2681.60034, 2145.78564, 54.80875);
        IsRaceRunning = false;
  		return 1;
        }
        return 1;
}
//______________________________________________________________________________
public OnPlayerDisconnect(playerid, reason)
{
    new
        szString[64],
        playerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, playerName, MAX_PLAYER_NAME);
    new szDisconnectReason[3][] =
    {
        "[CRASH]",
        "[IZGВJA]",
        "[IZMESTS]"
    };
    format(szString, sizeof szString, "%s pameta turnоru!(%s).", playerName, szDisconnectReason[reason]);//[----- Nolasвm atslзgрanas iemeslu -----]
    SendClientMessageToAll(0xFFFF29FF, szString);
    new currentveh;
    currentveh = GetPlayerVehicleID(playerid);
    DestroyVehicle(currentveh);
    return 1;
}
//______________________________________________________________________________
public Atskaite()
{
	TTA--;
    if(TTA > 0)
    {
	    new string[128];
	    format(string, 128, "Starts: %d!", TTA);//[----- Teksta formвts -----]
	    TextDrawSetString(Text:TTT, string);
	    TextDrawShowForAll(Text:TTT);//[----- Tekstu parвda visiem -----]
    }
    if(TTA == 10)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        SetPlayerCameraPos(i, -2139.7144,-249.4256,43.4512);
        SetPlayerCameraLookAt(i, -2115.5913,-225.8447,35.3203);
        }
	}
    if(TTA == 9)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        SetPlayerCameraPos(i, -2099.2671,-33.2677,81.5607);
        SetPlayerCameraLookAt(i, -2115.5913,-225.8447,35.3203);
        }
	}
    if(TTA == 8)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        SetPlayerCameraPos(i, -2091.7346,-136.8012,63.6033);
        SetPlayerCameraLookAt(i, -2115.5913,-225.8447,35.3203);
        }
	}
    if(TTA == 7)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        SetPlayerCameraPos(i, -2119.7112,-255.4921,43.0544);
        SetPlayerCameraLookAt(i, -2115.5913,-225.8447,35.3203);
        }
	}
    if(TTA == 6)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        SetPlayerCameraPos(i, -2112.8723,-196.1671,35.7004);
        SetPlayerCameraLookAt(i, -2115.5913,-225.8447,35.3203);
        }

    }
    if(TTA == 5)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        SetCameraBehindPlayer(i);
        PlayerPlaySound(i, 1138, 0.0, 0.0, 10.0);
        }
	}
    if(TTA == 4)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        GameTextForAll("~w~Ready!!",1000,3);
        PlayerPlaySound(i, 1138, 0.0, 0.0, 10.0);
        }
	}
    if(TTA == 0)
    {
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
        KillTimer(TTA);
        TogglePlayerControllable(i,1);//[----- Atsaldзjam spзlзtвju -----]
        TextDrawDestroy(TTT);//[----- Iznоcinвm tekstu -----]
        GameTextForAll("~w~GO!GO!GO!",2000,3);
        PlayerPlaySound(i, 1139, 0.0, 0.0, 10.0);
        SetCameraBehindPlayer(i);
        }
   	    return 1;
   	}
    return 1;
}
//______________________________________________________________________________
Reply
#2

PHP код:
for(new i;i<MAX_PLAYERS;i++)
    {
    if(
Player_CheckPoint[playerid] == 0)
    {
      
SetPlayerRaceCheckpoint(playerid,1,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
    }
    } 
That code is going through MAX_PLAYERS (500) checkpoints and setting the same playerids checkpoint, every time.

So what's happening is it's doing 500 checkpoints on connect for one player, to show only one for that one player.

PHP код:
//for(new i;i<MAX_PLAYERS;i++) 
    //{ 
    
if(Player_CheckPoint[playerid] == 0
    { 
      
SetPlayerRaceCheckpoint(playerid,1,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7); 
    } 
    
//} 
Try that, I've commented out just the loop, and really, that should fix it, if it is indeed the reason.
Reply
#3

Код:
//for(new i;i<MAX_PLAYERS;i++)  
    //{  
    if(Player_CheckPoint[playerid] == 0)  
    {  
      SetPlayerRaceCheckpoint(playerid,1,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);  
    }  
    //}
You think i need to delete for(new i;i<MAX_PLAYERS;i++) ? Not working..

When i connect to tournament - everything is working fine, when someone else connect, he got crash..


Lock this!
Reply
#4

Did it get fixed by this?


BTW, I like your method of using //_______ and //----- It just seems to make it easier to track where you are headed. (Even though it seems to be a bit random, it could be used more effectively. Even using //_______CALLBACKS______ or //______COMMANDS______ and //------Random stuff I added-----)
Reply
#5

The player-loop does not make sense at all. I also noticed that you use the same thing again in OnPlayerSpawn.

In order to set the race checkpoint when a player connects, the correct way would be to check if the race is available (if IsRaceRunning is true).

Reset variables on connect/disconnect.

If the server is crashing when a second player connects:
- load crashdetect plugin: https://github.com/Zeex/samp-plugin-...es/tag/v4.15.1
- compile with debug info: https://github.com/Zeex/samp-plugin-...ith-debug-info
- Start the server, join, start the race and let the other player to join the server. If it crashes, post the server log.
Reply
#6

Quote:
Originally Posted by Sew_Sumi
Посмотреть сообщение
Did it get fixed by this?


BTW, I like your method of using //_______ and //----- It just seems to make it easier to track where you are headed. (Even though it seems to be a bit random, it could be used more effectively. Even using //_______CALLBACKS______ or //______COMMANDS______ and //------Random stuff I added-----)
Yes and thank you Sew.

I dont know, why did i loop there, that was long time ago.
Anyway crashs fixed!
Reply
#7

Wonderful to hear...

Bare in mind what Konstantinos said about there being another loop in OnPlayerSpawn. -Edit- Oooh yea, that'll cause trouble too. Putting a player into a car, 500 times lol.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)