So. Try this:
PHP Code:
#define winner_money 100000
#define COLOR_RED 0xFF0000FF
enum RacePlaces
{
Float:Pos_X,
Float:Pos_Y,
Float:Pos_Z,
Float:Pos_A
};
new Float:PlaceInfo[14][RacePlaces] =
{
{-2824.0039,-427.6653,6.7661,2.2123},
{-2819.6379,-427.0293,6.7661,4.8471},
{-2823.9612,-434.4253,6.7661,1.8761},
{-2819.2588,-434.2224,6.7661,3.9896},
{-2823.5215,-441.6822,6.7661,3.4580},
{-2819.0369,-440.9862,6.7661,4.0346},
{-2822.8516,-448.9981,6.7661,7.3302},
{-2818.2061,-447.7987,6.7661,9.9531},
{-2820.7480,-456.4541,6.7661,20.0191},
{-2816.6711,-454.4347,6.7661,20.6467},
{-2817.3955,-463.4321,6.7661,33.4693},
{-2813.7688,-460.4954,6.7661,31.8096},
{-2812.2830,-469.7811,6.8356,46.6252},
{-2808.9436,-466.4615,6.8417,42.1020}
};
new g_Object[60];
new g_Pickup[2];
new ThreeWinner[3][MAX_PLAYER_NAME];
new bool:IsRaceStart;
new PlayerRaceTimer[MAX_PLAYERS];
new PlayerCheckTime[MAX_PLAYERS];
new bool:IsInRace[MAX_PLAYERS];
new bool:RacePlaceUse[14];
new RaceVehicles[MAX_VEHICLES];
//CPs
new Float:CheckPoints[159][3] =
{
{-2819.783,-398.911,6.766},
{-2809.968,-252.147,6.758},
{-2810.080,-225.016,6.758},
{-2794.481,-211.181,6.765},
{-2644.037,-211.783,3.889},
{-2605.936,-202.407,3.906},
{-2605.816,-181.893,3.906},
{-2612.862,-72.281,3.936},
{-2762.824,-69.563,6.861},
{-2809.610,-54.324,6.758},
{-2808.544,-34.176,6.767},
{-2808.079,-13.900,6.759},
{-2809.586,21.216,6.759},
{-2791.962,39.080,6.764},
{-2514.187,40.846,24.528},
{-2501.485,25.409,25.217},
{-2495.585,-71.188,25.284},
{-2344.810,-70.143,34.891},
{-2194.779,-70.182,34.899},
{-2044.122,-70.323,34.895},
{-2010.780,-60.937,34.896},
{-2006.482,12.679,32.920},
{-2024.180,28.823,33.375},
{-2107.160,43.043,34.891},
{-2106.622,73.367,34.891},
{-2105.858,95.616,34.891},
{-2120.015,111.003,34.900},
{-2150.456,120.943,34.896},
{-2148.517,140.975,34.898},
{-2146.512,167.034,34.898},
{-2148.205,221.273,34.898},
{-2136.215,318.486,34.888},
{-1988.034,344.208,34.617},
{-1878.934,367.942,22.763},
{-1876.119,387.952,18.374},
{-1867.623,406.948,16.744},
{-1818.817,492.369,26.417},
{-1917.438,604.859,34.743},
{-1998.778,597.280,34.774},
{-2116.668,504.444,34.742},
{-2229.343,489.635,34.743},
{-2253.935,341.613,33.600},
{-2262.293,319.931,34.957},
{-2400.340,257.083,27.458},
{-2515.275,162.980,3.902},
{-1550.646,854.280,6.763},
{-1699.558,850.754,24.461},
{-1716.607,887.708,24.468},
{-1692.472,922.648,24.466},
{-1543.459,936.569,6.766},
{-1529.301,961.379,6.774},
{-1588.902,1075.087,6.766},
{-1587.704,1109.483,6.766},
{-1607.894,1204.251,6.867},
{-1714.381,1181.824,24.703},
{-1790.326,1052.496,34.903},
{-1818.023,928.836,24.621},
{-1897.709,897.294,34.742},
{-1918.052,842.910,35.584},
{-2004.154,851.398,45.025},
{-2002.552,871.965,45.023},
{-2001.536,901.342,45.026},
{-2038.909,945.553,49.893},
{-2043.492,926.222,52.245},
{-2059.052,937.818,57.985},
{-2071.125,922.622,63.013},
{-2088.739,930.117,69.099},
{-2100.732,915.239,75.637},
{-2205.752,811.135,49.734},
{-2261.793,781.881,49.023},
{-2333.936,668.207,39.265},
{-2384.494,680.117,34.742},
{-2397.705,707.966,34.740},
{-2524.940,698.340,27.547},
{-2526.614,548.289,14.195},
{-2544.608,470.934,14.191},
{-2604.399,474.915,14.180},
{-2606.405,508.682,14.188},
{-2605.525,532.551,14.188},
{-2619.037,564.501,14.187},
{-2748.431,577.849,14.189},
{-2751.263,597.592,19.938},
{-2751.317,616.896,26.486},
{-2751.038,640.239,27.517},
{-2751.864,663.837,34.409},
{-2737.593,710.333,40.852},
{-2602.196,722.245,27.939},
{-2608.375,741.220,29.922},
{-2607.763,760.697,36.951},
{-2607.269,780.863,44.238},
{-2607.237,800.320,49.566},
{-2588.440,808.987,49.555},
{-2438.742,808.788,34.758},
{-2386.951,825.893,35.839},
{-2387.134,846.578,39.591},
{-2386.840,866.889,43.250},
{-2387.543,887.601,45.035},
{-2389.180,916.507,45.024},
{-2374.370,961.342,45.025},
{-2264.093,977.634,69.981},
{-2263.649,996.398,77.735},
{-2261.835,1015.659,83.355},
{-2141.989,1051.812,79.578},
{-2142.057,1072.123,79.572},
{-2141.202,1094.344,79.573},
{-2140.512,1114.171,76.182},
{-2136.590,1135.054,66.807},
{-2141.202,1162.380,55.732},
{-2123.782,1173.561,55.305},
{-1973.678,1178.306,45.024},
{-1969.577,1158.157,45.666},
{-1921.757,1076.451,49.276},
{-1888.479,1085.558,45.023},
{-1882.654,1135.954,45.023},
{-1884.286,1193.410,44.726},
{-1883.610,1213.465,39.296},
{-1813.030,1270.991,14.826},
{-1722.636,1300.601,6.769},
{-1730.122,1320.285,6.766},
{-1831.370,1357.048,6.765},
{-1965.259,1287.976,6.766},
{-2114.736,1273.396,18.491},
{-2259.656,1248.353,43.695},
{-2262.136,1102.384,80.395},
{-2261.132,953.020,66.199},
{-2265.061,804.366,49.023},
{-2385.620,782.456,34.748},
{-2386.178,632.208,34.159},
{-2404.503,564.596,24.468},
{-2525.650,554.373,14.196},
{-2547.135,469.858,14.191},
{-2696.775,466.217,3.840},
{-2846.741,470.903,3.845},
{-2698.665,1425.354,6.828},
{-2698.613,1296.335,6.859},
{-2562.500,1360.112,6.766},
{-2411.544,1375.003,6.766},
{-2264.432,1341.189,6.881},
{-2114.355,1329.725,6.766},
{-1964.401,1310.800,6.766},
{-1821.162,1357.624,6.769},
{-1693.904,1277.917,6.765},
{-1619.589,1186.826,6.811},
{-1768.902,1184.330,24.699},
{-1882.827,1160.853,45.024},
{-1920.489,1075.402,49.047},
{-2071.738,1076.356,55.294},
{-2224.531,1078.005,55.305},
{-2374.350,1096.843,55.307},
{-2524.050,1119.506,55.305},
{-2654.446,1195.754,55.157},
{-2677.200,1277.373,55.156},
{-2673.988,1318.617,55.156},
{-2674.625,1469.327,55.378},
{-2674.946,1619.605,64.859},
{-2675.255,1770.901,67.840},
{-2675.534,1922.283,64.319},
{-2675.554,1948.037,63.091},
{-2673.385,2036.146,57.420}
};
new Player_CheckPoint[MAX_PLAYERS];
new bool:IsRaceRunning = false;
new WinnerName[MAX_PLAYER_NAME];
new stringwin[64];
#if defined FILTERSCRIPT
// Init
public OnFilterScriptInit()
{
Create3DTextLabel("Welcome To FSFR!", 0x008080FF, -2821.2642, -443.1027, 7.0391, 40.0, 0, 0);
Create3DTextLabel("The BIG SF RACE,", 0x008080FF, -2821.2642, -444.1027, 7.0391, 40.0, 0, 0);
Create3DTextLabel("By Youssefree ,", 0xFFA200FF, -2821.2642, -445.1027, 7.0391, 40.0, 0, 0);
Create3DTextLabel("Winner Will Get 200000$,", 0x0A4DA4FF, -2821.2642, -446.1027, 7.0391, 40.0, 0, 0);
g_Object[0] = CreateObject(2904, -2805.5964, -468.5556, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[1] = CreateObject(620, -2809.3510, -474.8958, 6.2093, 0.0000, 0.0000, 0.0000); //veg_palm04
g_Object[2] = CreateObject(620, -2804.1604, -467.6058, 6.2093, 0.0000, 0.0000, 0.0000); //veg_palm04
g_Object[3] = CreateObject(2904, -2806.9382, -470.4234, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[4] = CreateObject(2904, -2808.3623, -472.4049, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[5] = CreateObject(2904, -2809.4892, -473.9722, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[6] = CreateObject(2904, -2805.5627, -468.5021, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[7] = CreateObject(2904, -2806.9458, -470.4124, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[8] = CreateObject(2904, -2808.1887, -472.1420, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[9] = CreateObject(2904, -2809.4628, -473.9122, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
g_Object[10] = CreateObject(2878, -2807.7458, -471.7142, 7.3435, 0.0000, 0.0000, 53.9999); //CJ_Victim_DOOR
g_Object[11] = CreateObject(16500, -2812.0273, -473.1810, 8.1200, 0.0000, 0.0000, 44.6999); //cn2_savgardr1_
g_Object[12] = CreateObject(16500, -2815.4487, -469.6052, 8.1200, 0.0000, 0.0000, 42.8999); //cn2_savgardr1_
g_Object[13] = CreateObject(16500, -2815.4487, -469.6052, 8.1200, 0.0000, 0.0000, 42.8999); //cn2_savgardr1_
g_Object[14] = CreateObject(16500, -2818.4733, -465.7384, 8.1200, 0.0000, 0.0000, 33.8000); //cn2_savgardr1_
g_Object[15] = CreateObject(16500, -2821.0205, -461.5421, 8.1200, 0.0000, 0.0000, 28.8000); //cn2_savgardr1_
g_Object[16] = CreateObject(16500, -2822.9963, -457.0747, 8.1200, 0.0000, 0.0000, 18.9000); //cn2_savgardr1_
g_Object[17] = CreateObject(16500, -2824.3903, -452.3598, 8.1200, 0.0000, 0.0000, 14.0000); //cn2_savgardr1_
g_Object[18] = CreateObject(16500, -2825.3864, -447.5438, 8.1200, 0.0000, 0.0000, 9.3000); //cn2_savgardr1_
g_Object[19] = CreateObject(16500, -2825.9365, -442.6497, 8.1200, 0.0000, 0.0000, 3.6000); //cn2_savgardr1_
g_Object[20] = CreateObject(16500, -2826.2458, -437.7394, 8.1200, 0.0000, 0.0000, 3.6000); //cn2_savgardr1_
g_Object[21] = CreateObject(16500, -2826.5556, -432.8391, 8.1200, 0.0000, 0.0000, 3.6000); //cn2_savgardr1_
g_Object[22] = CreateObject(16500, -2826.7548, -427.9270, 8.1200, 0.0000, 0.0000, 1.0000); //cn2_savgardr1_
g_Object[23] = CreateObject(16500, -2826.8383, -422.9877, 8.1200, 0.0000, 0.0000, 1.0000); //cn2_savgardr1_
g_Object[24] = CreateObject(16500, -2826.9233, -418.0583, 8.1200, 0.0000, 0.0000, 1.0000); //cn2_savgardr1_
g_Object[25] = CreateObject(16500, -2806.5844, -465.7168, 8.1200, 0.0000, 0.0000, 42.0999); //cn2_savgardr1_
g_Object[26] = CreateObject(16500, -2809.7097, -461.9146, 8.1200, 0.0000, 0.0000, 36.5999); //cn2_savgardr1_
g_Object[27] = CreateObject(16500, -2812.4201, -457.8130, 8.1200, 0.0000, 0.0000, 30.1999); //cn2_savgardr1_
g_Object[28] = CreateObject(16500, -2814.4536, -453.3471, 8.1200, 0.0000, 0.0000, 18.7999); //cn2_savgardr1_
g_Object[29] = CreateObject(16500, -2815.7155, -448.6064, 8.1200, 0.0000, 0.0000, 10.9999); //cn2_savgardr1_
g_Object[30] = CreateObject(16500, -2816.3852, -443.7413, 8.1200, 0.0000, 0.0000, 4.4999); //cn2_savgardr1_
g_Object[31] = CreateObject(16500, -2816.7724, -438.8165, 8.1200, 0.0000, 0.0000, 3.5999); //cn2_savgardr1_
g_Object[32] = CreateObject(16500, -2817.0820, -433.8965, 8.1200, 0.0000, 0.0000, 3.5999); //cn2_savgardr1_
g_Object[33] = CreateObject(16500, -2817.3225, -428.9743, 8.1200, 0.0000, 0.0000, 1.4999); //cn2_savgardr1_
g_Object[34] = CreateObject(16500, -2817.4011, -424.0357, 8.1200, 0.0000, 0.0000, 0.1999); //cn2_savgardr1_
g_Object[35] = CreateObject(16500, -2817.4162, -419.0958, 8.1200, 0.0000, 0.0000, 0.1999); //cn2_savgardr1_
g_Object[36] = CreateObject(16500, -2817.4196, -417.5459, 8.1200, 0.0000, 0.0000, 0.1999); //cn2_savgardr1_
g_Object[37] = CreateObject(11431, -2809.4099, -479.3891, 7.6007, 0.0000, 0.0000, -37.0999); //des_tepeoff01
g_Object[38] = CreateObject(7073, -2809.9130, -480.1479, 27.0409, 2.3000, 0.0000, 6.6999); //vegascowboy1
g_Object[39] = CreateObject(3749, -2822.1730, -414.8966, 11.9603, 0.0000, 0.0000, 0.0000); //ClubGate01_LAx
g_Object[40] = CreateObject(16500, -2815.1440, -414.2999, 8.1200, 0.0000, 0.0000, -70.4001); //cn2_savgardr1_
g_Object[41] = CreateObject(16500, -2829.0209, -414.3475, 8.1200, 0.0000, 0.0000, -121.9000); //cn2_savgardr1_
g_Object[42] = CreateObject(980, -2821.9953, -414.1422, 8.8947, 0.0000, 0.0000, 0.0000); //airportgate
g_Object[43] = CreateObject(18647, -2811.7165, -463.4261, 5.8051, 0.0000, 0.0000, -47.5999); //RedNeonTube1
g_Object[44] = CreateObject(18647, -2815.4831, -467.1696, 5.7951, 0.0000, 0.0000, -40.2999); //RedNeonTube1
g_Object[45] = CreateObject(18648, -2815.7639, -457.3795, 6.1944, 0.0000, 0.0000, -60.8999); //BlueNeonTube1
g_Object[46] = CreateObject(18648, -2819.6264, -459.5291, 6.1944, 0.0000, 0.0000, -60.8999); //BlueNeonTube1
g_Object[47] = CreateObject(18650, -2823.2763, -445.4010, 6.2068, 0.0000, 0.0000, -83.0000); //YellowNeonTube1
g_Object[48] = CreateObject(18649, -2817.9553, -450.8033, 6.2660, -0.6999, 0.0000, -73.9999); //GreenNeonTube1
g_Object[49] = CreateObject(18649, -2822.0620, -452.3346, 6.3194, -0.6999, 0.0000, -73.9999); //GreenNeonTube1
g_Object[50] = CreateObject(18650, -2818.8627, -444.4053, 6.2068, 0.0000, 0.0000, -83.0000); //YellowNeonTube1
g_Object[51] = CreateObject(18651, -2819.3071, -437.3047, 6.3310, 0.0000, 0.0000, -84.1999); //PinkNeonTube1
g_Object[52] = CreateObject(18651, -2823.9138, -437.7725, 6.3310, 0.0000, 0.0000, -84.1999); //PinkNeonTube1
g_Object[53] = CreateObject(18652, -2824.2817, -431.1313, 6.4255, 0.0000, 0.0000, 95.4000); //WhiteNeonTube1
g_Object[54] = CreateObject(18652, -2819.7119, -430.6991, 6.4255, 0.0000, 0.0000, 92.9000); //WhiteNeonTube1
g_Object[55] = CreateObject(18647, -2818.6191, -423.3435, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
g_Object[56] = CreateObject(18647, -2820.7727, -423.5280, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
g_Object[57] = CreateObject(18647, -2822.9631, -423.7160, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
g_Object[58] = CreateObject(18647, -2825.2641, -423.9133, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
g_Pickup[0] = CreatePickup(1313, 1, -2807.0219, -471.4404, 7.1375, -1); //killfrenzy2plyr
g_Pickup[1] = CreatePickup(1314, 1, -2807.3757, -478.2558, 7.6394, -1); //twoplayer
}
public OnPlayerCommandText()
{
if(!strcmp(cmdtext,"/joinrace",true))
{
GivePlayerMoney(playerid, -10000);
SendClientMessage(playerid, COLOR_RED, "You paid 10,000$ due to tax and skills reasons :3");
if(!IsPlayerInRangeOfPoint(playerid,4.0,-2807.7458, -471.7142, 7.3435))return SendClientMessage(playerid,-1,"You aren't in range of the vicitim door!");
if(IsInRace[playerid] == true)return SendClientMessage(playerid,-1,"You already joined the race!");
IsInRace[playerid] = true;
new veh_index;
for(new i;i<sizeof(RaceVehicles);i++)
{
if(RaceVehicles[i] > 0)continue;
veh_index = i;
break;
}
for(new i;i<sizeof(PlaceInfo);i++)
{
if(RacePlaceUse[i] == true)continue;
RacePlaceUse[i] = true;
RaceVehicles[veh_index] = CreateVehicle(411,PlaceInfo[i][Pos_X],PlaceInfo[i][Pos_Y],PlaceInfo[i][Pos_Z],PlaceInfo[i][Pos_A],-1,-1,-1);
SetVehicleHealth(RaceVehicles[veh_index],100000);
PutPlayerInVehicle(playerid,RaceVehicles[veh_index],0);
TogglePlayerControllable(playerid,0);
break;
}
SendClientMessageToAll(-1,"Join the race! (/joinrace)");
return 1;
}
else if(!strcmp(cmdtext,"/startrace",true))
{
if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"You have to log in RCON!");
if(IsRaceStart == true)return SendClientMessage(playerid,-1,"The race is already started!");
IsRaceStart = true;
MoveObject(g_Object[42],-2821.9953, -414.1422, -10.8947,9.0);//When it's to slowly, then increase 2.0 - lower when it's the other way around
SendClientMessageToAll(-1,"The race starts!!!!!");
for(new i;i<MAX_PLAYERS;i++)
{
if(IsInRace[i] == true)
{
TogglePlayerControllable(i,1);
PlayerRaceTimer[i] = SetTimerEx("RaceTimer",1000,1,"i",i);
PlayerCheckTime[i] = gettime()+20;
}
}
return 1;
}
return 0;
}
public OnPlayerEnterRaceCheckpoint(playerid)
{
if(IsRaceRunning == true)
{
DisablePlayerRaceCheckpoint(playerid);
Player_CheckPoint[playerid] ++;
if(Player_CheckPoint[playerid] < 158)
{
PlayerCheckTime[playerid] = gettime()+20;
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],9.7);
}
else if(Player_CheckPoint[playerid] == 158)
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsInRace[i] == true)
{
DisablePlayerRaceCheckpoint(i);
SetPlayerPos(i,-2804.5796,-472.9876,7.1875);// CoorDs Outside
IsInRace[i] = false;
}
}
for(new i;i<sizeof(RaceVehicles);i++)
{
if(RaceVehicles[i] == GetPlayerVehicleID(playerid))
{
DestroyVehicle(RaceVehicles[i]);
RaceVehicles[i] = 0;
}
}
GetPlayerName(playerid,WinnerName,sizeof(WinnerName));
if(!strlen(ThreeWinner[0]))format(ThreeName[0],MAX_PLAYER_NAME,WinnerName);
else if(!strlen(ThreeWinner[1]))format(ThreeName[1],MAX_PLAYER_NAME,WinnerName);
else if(!strlen(ThreeWinner[2]))format(ThreeName[2],MAX_PLAYER_NAME,WinnerName);
format(stringwin,sizeof(stringwin),"[RACE] The race is over, %s has won and achieved $%d!",ThreeWinner[0],winner_money);
SendClientMessageToAll(0xFF0000FF,stringwin);
GivePlayerMoney(GetIDofName(ThreeWinner[0]),10000);
GivePlayerMoney(GetIDofName(ThreeWinner[1]),9000);
GivePlayerMoney(GetIDofName(ThreeWinner[2]),8000);
IsRaceStart = false;
return 1;
}
}
return 1;
}
public OnPlayerConnect(playerid)
{
// Credits and Start Place
Player_CheckPoint[playerid] = 0;
SetPlayerRaceCheckpoint(playerid,0,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
IsRaceRunning = true;
return 1;
}
forward RaceTimer(playerid);
public RaceTimer(playerid)
{
if(gettime() > PlayerCheckTime[playerid])
{
for(new i;i<sizeof(RaceVehicles);i++)
{
if(RacesVehicles[i] == GetPlayerVehicleID(playerid))
{
RacesVehicles[i] = 0;
break;
}
}
DestroyVehicle(GetPlayerVehicleID(playerid));
IsInRace[playerid] = false;
KillTimer(PlayerRaceTimer[playerid]);
SetPlayerPos(playerid,-2804.5796,-472.9876,7.1875);//CoorDs Outside
}
return 1;
}
stock GetIDofName(name_[])
{
new get_name[MAX_PLAYER_NAME];
for(new i;i<MAX_PLAYERS;i++)
{
if(!GetPlayerName(i,get_name,MAX_PLAYER_NAME))return -1;
if(!strcmp(get_name,name_,false))return i;
}
return -1;
}