Advertisement
Guest User

Untitled

a guest
Jul 8th, 2016
102
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*                  01011001 01101111 01110101 01110011 01110011
  2.                     01100101 01100110 01110010 01100101 01100101
  3.                     *FSFR - Full San Fierro Race by Youssefree*                                                   */
  4.  
  5. #include <a_samp>
  6.  
  7. #define FILTERSCRIPT
  8.  
  9. #define winner_money 100000
  10. #define COLOR_RED 0xFF0000FF
  11.  
  12. enum RacePlaces
  13. {
  14.     Float:Pos_X,
  15.     Float:Pos_Y,
  16.     Float:Pos_Z,
  17.     Float:Pos_A
  18. };
  19.  
  20. new Float:PlaceInfo[14][RacePlaces] =
  21. {
  22.     {-2824.0039,-427.6653,6.7661,2.2123},
  23.     {-2819.6379,-427.0293,6.7661,4.8471},
  24.     {-2823.9612,-434.4253,6.7661,1.8761},
  25.     {-2819.2588,-434.2224,6.7661,3.9896},
  26.     {-2823.5215,-441.6822,6.7661,3.4580},
  27.     {-2819.0369,-440.9862,6.7661,4.0346},
  28.     {-2822.8516,-448.9981,6.7661,7.3302},
  29.     {-2818.2061,-447.7987,6.7661,9.9531},
  30.     {-2820.7480,-456.4541,6.7661,20.0191},
  31.     {-2816.6711,-454.4347,6.7661,20.6467},
  32.     {-2817.3955,-463.4321,6.7661,33.4693},
  33.     {-2813.7688,-460.4954,6.7661,31.8096},
  34.     {-2812.2830,-469.7811,6.8356,46.6252},
  35.     {-2808.9436,-466.4615,6.8417,42.1020}
  36. };
  37.  
  38. new g_Object[60];
  39. new g_Pickup[2];
  40. new ThreeWinner[3][MAX_PLAYER_NAME];
  41. new bool:IsRaceStart;
  42. new PlayerRaceTimer[MAX_PLAYERS];
  43. new PlayerCheckTime[MAX_PLAYERS];
  44. new bool:IsInRace[MAX_PLAYERS];
  45. new bool:RacePlaceUse[14];
  46. new RaceVehicles[MAX_VEHICLES];
  47.  
  48. //CPs
  49. new Float:CheckPoints[159][3] =
  50. {
  51. {-2819.783,-398.911,6.766},
  52. {-2809.968,-252.147,6.758},
  53. {-2810.080,-225.016,6.758},
  54. {-2794.481,-211.181,6.765},
  55. {-2644.037,-211.783,3.889},
  56. {-2605.936,-202.407,3.906},
  57. {-2605.816,-181.893,3.906},
  58. {-2612.862,-72.281,3.936},
  59. {-2762.824,-69.563,6.861},
  60. {-2809.610,-54.324,6.758},
  61. {-2808.544,-34.176,6.767},
  62. {-2808.079,-13.900,6.759},
  63. {-2809.586,21.216,6.759},
  64. {-2791.962,39.080,6.764},
  65. {-2514.187,40.846,24.528},
  66. {-2501.485,25.409,25.217},
  67. {-2495.585,-71.188,25.284},
  68. {-2344.810,-70.143,34.891},
  69. {-2194.779,-70.182,34.899},
  70. {-2044.122,-70.323,34.895},
  71. {-2010.780,-60.937,34.896},
  72. {-2006.482,12.679,32.920},
  73. {-2024.180,28.823,33.375},
  74. {-2107.160,43.043,34.891},
  75. {-2106.622,73.367,34.891},
  76. {-2105.858,95.616,34.891},
  77. {-2120.015,111.003,34.900},
  78. {-2150.456,120.943,34.896},
  79. {-2148.517,140.975,34.898},
  80. {-2146.512,167.034,34.898},
  81. {-2148.205,221.273,34.898},
  82. {-2136.215,318.486,34.888},
  83. {-1988.034,344.208,34.617},
  84. {-1878.934,367.942,22.763},
  85. {-1876.119,387.952,18.374},
  86. {-1867.623,406.948,16.744},
  87. {-1818.817,492.369,26.417},
  88. {-1917.438,604.859,34.743},
  89. {-1998.778,597.280,34.774},
  90. {-2116.668,504.444,34.742},
  91. {-2229.343,489.635,34.743},
  92. {-2253.935,341.613,33.600},
  93. {-2262.293,319.931,34.957},
  94. {-2400.340,257.083,27.458},
  95. {-2515.275,162.980,3.902},
  96. {-1550.646,854.280,6.763},
  97. {-1699.558,850.754,24.461},
  98. {-1716.607,887.708,24.468},
  99. {-1692.472,922.648,24.466},
  100. {-1543.459,936.569,6.766},
  101. {-1529.301,961.379,6.774},
  102. {-1588.902,1075.087,6.766},
  103. {-1587.704,1109.483,6.766},
  104. {-1607.894,1204.251,6.867},
  105. {-1714.381,1181.824,24.703},
  106. {-1790.326,1052.496,34.903},
  107. {-1818.023,928.836,24.621},
  108. {-1897.709,897.294,34.742},
  109. {-1918.052,842.910,35.584},
  110. {-2004.154,851.398,45.025},
  111. {-2002.552,871.965,45.023},
  112. {-2001.536,901.342,45.026},
  113. {-2038.909,945.553,49.893},
  114. {-2043.492,926.222,52.245},
  115. {-2059.052,937.818,57.985},
  116. {-2071.125,922.622,63.013},
  117. {-2088.739,930.117,69.099},
  118. {-2100.732,915.239,75.637},
  119. {-2205.752,811.135,49.734},
  120. {-2261.793,781.881,49.023},
  121. {-2333.936,668.207,39.265},
  122. {-2384.494,680.117,34.742},
  123. {-2397.705,707.966,34.740},
  124. {-2524.940,698.340,27.547},
  125. {-2526.614,548.289,14.195},
  126. {-2544.608,470.934,14.191},
  127. {-2604.399,474.915,14.180},
  128. {-2606.405,508.682,14.188},
  129. {-2605.525,532.551,14.188},
  130. {-2619.037,564.501,14.187},
  131. {-2748.431,577.849,14.189},
  132. {-2751.263,597.592,19.938},
  133. {-2751.317,616.896,26.486},
  134. {-2751.038,640.239,27.517},
  135. {-2751.864,663.837,34.409},
  136. {-2737.593,710.333,40.852},
  137. {-2602.196,722.245,27.939},
  138. {-2608.375,741.220,29.922},
  139. {-2607.763,760.697,36.951},
  140. {-2607.269,780.863,44.238},
  141. {-2607.237,800.320,49.566},
  142. {-2588.440,808.987,49.555},
  143. {-2438.742,808.788,34.758},
  144. {-2386.951,825.893,35.839},
  145. {-2387.134,846.578,39.591},
  146. {-2386.840,866.889,43.250},
  147. {-2387.543,887.601,45.035},
  148. {-2389.180,916.507,45.024},
  149. {-2374.370,961.342,45.025},
  150. {-2264.093,977.634,69.981},
  151. {-2263.649,996.398,77.735},
  152. {-2261.835,1015.659,83.355},
  153. {-2141.989,1051.812,79.578},
  154. {-2142.057,1072.123,79.572},
  155. {-2141.202,1094.344,79.573},
  156. {-2140.512,1114.171,76.182},
  157. {-2136.590,1135.054,66.807},
  158. {-2141.202,1162.380,55.732},
  159. {-2123.782,1173.561,55.305},
  160. {-1973.678,1178.306,45.024},
  161. {-1969.577,1158.157,45.666},
  162. {-1921.757,1076.451,49.276},
  163. {-1888.479,1085.558,45.023},
  164. {-1882.654,1135.954,45.023},
  165. {-1884.286,1193.410,44.726},
  166. {-1883.610,1213.465,39.296},
  167. {-1813.030,1270.991,14.826},
  168. {-1722.636,1300.601,6.769},
  169. {-1730.122,1320.285,6.766},
  170. {-1831.370,1357.048,6.765},
  171. {-1965.259,1287.976,6.766},
  172. {-2114.736,1273.396,18.491},
  173. {-2259.656,1248.353,43.695},
  174. {-2262.136,1102.384,80.395},
  175. {-2261.132,953.020,66.199},
  176. {-2265.061,804.366,49.023},
  177. {-2385.620,782.456,34.748},
  178. {-2386.178,632.208,34.159},
  179. {-2404.503,564.596,24.468},
  180. {-2525.650,554.373,14.196},
  181. {-2547.135,469.858,14.191},
  182. {-2696.775,466.217,3.840},
  183. {-2846.741,470.903,3.845},
  184. {-2698.665,1425.354,6.828},
  185. {-2698.613,1296.335,6.859},
  186. {-2562.500,1360.112,6.766},
  187. {-2411.544,1375.003,6.766},
  188. {-2264.432,1341.189,6.881},
  189. {-2114.355,1329.725,6.766},
  190. {-1964.401,1310.800,6.766},
  191. {-1821.162,1357.624,6.769},
  192. {-1693.904,1277.917,6.765},
  193. {-1619.589,1186.826,6.811},
  194. {-1768.902,1184.330,24.699},
  195. {-1882.827,1160.853,45.024},
  196. {-1920.489,1075.402,49.047},
  197. {-2071.738,1076.356,55.294},
  198. {-2224.531,1078.005,55.305},
  199. {-2374.350,1096.843,55.307},
  200. {-2524.050,1119.506,55.305},
  201. {-2654.446,1195.754,55.157},
  202. {-2677.200,1277.373,55.156},
  203. {-2673.988,1318.617,55.156},
  204. {-2674.625,1469.327,55.378},
  205. {-2674.946,1619.605,64.859},
  206. {-2675.255,1770.901,67.840},
  207. {-2675.534,1922.283,64.319},
  208. {-2675.554,1948.037,63.091},
  209. {-2673.385,2036.146,57.420}
  210. };
  211.  
  212. new Player_CheckPoint[MAX_PLAYERS];
  213. new bool:IsRaceRunning = false;
  214. new WinnerName[MAX_PLAYER_NAME];
  215. new stringwin[64];
  216.  
  217. #if defined FILTERSCRIPT
  218. // Init
  219. public OnFilterScriptInit()
  220. {
  221.     Create3DTextLabel("Welcome To FSFR!", 0x008080FF, -2821.2642, -443.1027, 7.0391, 40.0, 0, 0);
  222.     Create3DTextLabel("The BIG SF RACE,", 0x008080FF, -2821.2642, -444.1027, 7.0391, 40.0, 0, 0);
  223.     Create3DTextLabel("By Youssefree ,", 0xFFA200FF, -2821.2642, -445.1027, 7.0391, 40.0, 0, 0);
  224.     Create3DTextLabel("Winner Will Get 200000$,", 0x0A4DA4FF, -2821.2642, -446.1027, 7.0391, 40.0, 0, 0);
  225.    
  226. g_Object[0] = CreateObject(2904, -2805.5964, -468.5556, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
  227. g_Object[1] = CreateObject(620, -2809.3510, -474.8958, 6.2093, 0.0000, 0.0000, 0.0000); //veg_palm04
  228. g_Object[2] = CreateObject(620, -2804.1604, -467.6058, 6.2093, 0.0000, 0.0000, 0.0000); //veg_palm04
  229. g_Object[3] = CreateObject(2904, -2806.9382, -470.4234, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
  230. g_Object[4] = CreateObject(2904, -2808.3623, -472.4049, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
  231. g_Object[5] = CreateObject(2904, -2809.4892, -473.9722, 7.4607, 0.0000, 0.0000, 54.2999); //warehouse_door1
  232. g_Object[6] = CreateObject(2904, -2805.5627, -468.5021, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
  233. g_Object[7] = CreateObject(2904, -2806.9458, -470.4124, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
  234. g_Object[8] = CreateObject(2904, -2808.1887, -472.1420, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
  235. g_Object[9] = CreateObject(2904, -2809.4628, -473.9122, 9.2606, 0.0000, 0.0000, 54.2999); //warehouse_door1
  236. g_Object[10] = CreateObject(2878, -2807.7458, -471.7142, 7.3435, 0.0000, 0.0000, 53.9999); //CJ_Victim_DOOR
  237. g_Object[11] = CreateObject(16500, -2812.0273, -473.1810, 8.1200, 0.0000, 0.0000, 44.6999); //cn2_savgardr1_
  238. g_Object[12] = CreateObject(16500, -2815.4487, -469.6052, 8.1200, 0.0000, 0.0000, 42.8999); //cn2_savgardr1_
  239. g_Object[13] = CreateObject(16500, -2815.4487, -469.6052, 8.1200, 0.0000, 0.0000, 42.8999); //cn2_savgardr1_
  240. g_Object[14] = CreateObject(16500, -2818.4733, -465.7384, 8.1200, 0.0000, 0.0000, 33.8000); //cn2_savgardr1_
  241. g_Object[15] = CreateObject(16500, -2821.0205, -461.5421, 8.1200, 0.0000, 0.0000, 28.8000); //cn2_savgardr1_
  242. g_Object[16] = CreateObject(16500, -2822.9963, -457.0747, 8.1200, 0.0000, 0.0000, 18.9000); //cn2_savgardr1_
  243. g_Object[17] = CreateObject(16500, -2824.3903, -452.3598, 8.1200, 0.0000, 0.0000, 14.0000); //cn2_savgardr1_
  244. g_Object[18] = CreateObject(16500, -2825.3864, -447.5438, 8.1200, 0.0000, 0.0000, 9.3000); //cn2_savgardr1_
  245. g_Object[19] = CreateObject(16500, -2825.9365, -442.6497, 8.1200, 0.0000, 0.0000, 3.6000); //cn2_savgardr1_
  246. g_Object[20] = CreateObject(16500, -2826.2458, -437.7394, 8.1200, 0.0000, 0.0000, 3.6000); //cn2_savgardr1_
  247. g_Object[21] = CreateObject(16500, -2826.5556, -432.8391, 8.1200, 0.0000, 0.0000, 3.6000); //cn2_savgardr1_
  248. g_Object[22] = CreateObject(16500, -2826.7548, -427.9270, 8.1200, 0.0000, 0.0000, 1.0000); //cn2_savgardr1_
  249. g_Object[23] = CreateObject(16500, -2826.8383, -422.9877, 8.1200, 0.0000, 0.0000, 1.0000); //cn2_savgardr1_
  250. g_Object[24] = CreateObject(16500, -2826.9233, -418.0583, 8.1200, 0.0000, 0.0000, 1.0000); //cn2_savgardr1_
  251. g_Object[25] = CreateObject(16500, -2806.5844, -465.7168, 8.1200, 0.0000, 0.0000, 42.0999); //cn2_savgardr1_
  252. g_Object[26] = CreateObject(16500, -2809.7097, -461.9146, 8.1200, 0.0000, 0.0000, 36.5999); //cn2_savgardr1_
  253. g_Object[27] = CreateObject(16500, -2812.4201, -457.8130, 8.1200, 0.0000, 0.0000, 30.1999); //cn2_savgardr1_
  254. g_Object[28] = CreateObject(16500, -2814.4536, -453.3471, 8.1200, 0.0000, 0.0000, 18.7999); //cn2_savgardr1_
  255. g_Object[29] = CreateObject(16500, -2815.7155, -448.6064, 8.1200, 0.0000, 0.0000, 10.9999); //cn2_savgardr1_
  256. g_Object[30] = CreateObject(16500, -2816.3852, -443.7413, 8.1200, 0.0000, 0.0000, 4.4999); //cn2_savgardr1_
  257. g_Object[31] = CreateObject(16500, -2816.7724, -438.8165, 8.1200, 0.0000, 0.0000, 3.5999); //cn2_savgardr1_
  258. g_Object[32] = CreateObject(16500, -2817.0820, -433.8965, 8.1200, 0.0000, 0.0000, 3.5999); //cn2_savgardr1_
  259. g_Object[33] = CreateObject(16500, -2817.3225, -428.9743, 8.1200, 0.0000, 0.0000, 1.4999); //cn2_savgardr1_
  260. g_Object[34] = CreateObject(16500, -2817.4011, -424.0357, 8.1200, 0.0000, 0.0000, 0.1999); //cn2_savgardr1_
  261. g_Object[35] = CreateObject(16500, -2817.4162, -419.0958, 8.1200, 0.0000, 0.0000, 0.1999); //cn2_savgardr1_
  262. g_Object[36] = CreateObject(16500, -2817.4196, -417.5459, 8.1200, 0.0000, 0.0000, 0.1999); //cn2_savgardr1_
  263. g_Object[37] = CreateObject(11431, -2809.4099, -479.3891, 7.6007, 0.0000, 0.0000, -37.0999); //des_tepeoff01
  264. g_Object[38] = CreateObject(7073, -2809.9130, -480.1479, 27.0409, 2.3000, 0.0000, 6.6999); //vegascowboy1
  265. g_Object[39] = CreateObject(3749, -2822.1730, -414.8966, 11.9603, 0.0000, 0.0000, 0.0000); //ClubGate01_LAx
  266. g_Object[40] = CreateObject(16500, -2815.1440, -414.2999, 8.1200, 0.0000, 0.0000, -70.4001); //cn2_savgardr1_
  267. g_Object[41] = CreateObject(16500, -2829.0209, -414.3475, 8.1200, 0.0000, 0.0000, -121.9000); //cn2_savgardr1_
  268. g_Object[42] = CreateObject(980, -2821.9953, -414.1422, 8.8947, 0.0000, 0.0000, 0.0000); //airportgate
  269. g_Object[43] = CreateObject(18647, -2811.7165, -463.4261, 5.8051, 0.0000, 0.0000, -47.5999); //RedNeonTube1
  270. g_Object[44] = CreateObject(18647, -2815.4831, -467.1696, 5.7951, 0.0000, 0.0000, -40.2999); //RedNeonTube1
  271. g_Object[45] = CreateObject(18648, -2815.7639, -457.3795, 6.1944, 0.0000, 0.0000, -60.8999); //BlueNeonTube1
  272. g_Object[46] = CreateObject(18648, -2819.6264, -459.5291, 6.1944, 0.0000, 0.0000, -60.8999); //BlueNeonTube1
  273. g_Object[47] = CreateObject(18650, -2823.2763, -445.4010, 6.2068, 0.0000, 0.0000, -83.0000); //YellowNeonTube1
  274. g_Object[48] = CreateObject(18649, -2817.9553, -450.8033, 6.2660, -0.6999, 0.0000, -73.9999); //GreenNeonTube1
  275. g_Object[49] = CreateObject(18649, -2822.0620, -452.3346, 6.3194, -0.6999, 0.0000, -73.9999); //GreenNeonTube1
  276. g_Object[50] = CreateObject(18650, -2818.8627, -444.4053, 6.2068, 0.0000, 0.0000, -83.0000); //YellowNeonTube1
  277. g_Object[51] = CreateObject(18651, -2819.3071, -437.3047, 6.3310, 0.0000, 0.0000, -84.1999); //PinkNeonTube1
  278. g_Object[52] = CreateObject(18651, -2823.9138, -437.7725, 6.3310, 0.0000, 0.0000, -84.1999); //PinkNeonTube1
  279. g_Object[53] = CreateObject(18652, -2824.2817, -431.1313, 6.4255, 0.0000, 0.0000, 95.4000); //WhiteNeonTube1
  280. g_Object[54] = CreateObject(18652, -2819.7119, -430.6991, 6.4255, 0.0000, 0.0000, 92.9000); //WhiteNeonTube1
  281. g_Object[55] = CreateObject(18647, -2818.6191, -423.3435, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
  282. g_Object[56] = CreateObject(18647, -2820.7727, -423.5280, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
  283. g_Object[57] = CreateObject(18647, -2822.9631, -423.7160, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
  284. g_Object[58] = CreateObject(18647, -2825.2641, -423.9133, 6.2353, 0.0000, 0.0000, -85.0999); //RedNeonTube1
  285.  
  286. g_Pickup[0] = CreatePickup(1313, 1, -2807.0219, -471.4404, 7.1375, -1); //killfrenzy2plyr
  287. g_Pickup[1] = CreatePickup(1314, 1, -2807.3757, -478.2558, 7.6394, -1); //twoplayer
  288. }
  289.  
  290. public OnPlayerCommandText()
  291. {
  292. if(!strcmp(cmdtext,"/joinrace",true))
  293. {
  294.     GivePlayerMoney(playerid, -10000);
  295.     SendClientMessage(playerid, COLOR_RED, "You paid 10,000$ due to tax and skills reasons :3");
  296.     if(!IsPlayerInRangeOfPoint(playerid,4.0,-2807.7458, -471.7142, 7.3435))return SendClientMessage(playerid,-1,"You aren't in range of the vicitim door!");
  297.     if(IsInRace[playerid] == true)return SendClientMessage(playerid,-1,"You already joined the race!");
  298.     IsInRace[playerid] = true;
  299.     new veh_index;
  300.     for(new i;i<RaceVehicles;i++)
  301.     {
  302.         if(RaceVehicles[i] > 0)continue;
  303.         veh_index = i;
  304.         break;
  305.     }
  306.     for(new i;i<PlaceInfo;i++)
  307.     {
  308.         if(RacePlaceUse[i] == true)continue;
  309.         RacePlaceUse[i] = true;
  310.         RaceVehicles[veh_index] = CreateVehicle(411,PlaceInfo[i][Pos_X],PlaceInfo[i][Pos_Y],PlaceInfo[i][Pos_Z],PlaceInfo[i][Pos_A],-1,-1,-1);
  311.         SetVehicleHealth(RaceVehicles[veh_index],100000);
  312.         PutPlayerInVehicle(playerid,RaceVehicles[veh_index],0);
  313.         TogglePlayerControllable(playerid,0);
  314.         break;
  315.     }
  316.     SendClientMessageToAll(-1,"Join the race! (/joinrace)");
  317.     return 1;
  318. }
  319. else if(!strcmp(cmdtext,"/startrace",true))
  320. {
  321.     if(!IsPlayerAdmin(playerid))return SendClientMessage(playerid,-1,"You have to log in RCON!");
  322.     if(IsRaceStart == true)return SendClientMessage(playerid,-1,"The race is already started!");
  323.     IsRaceStart = true;
  324.     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
  325.     SendClientMessageToAll(-1,"The race starts!!!!!");
  326.     for(new i;i<MAX_PLAYERS;i++)
  327.     {
  328.         if(IsInRace[i] == true)
  329.         {
  330.             TogglePlayerControllable(i,1);
  331.             PlayerRaceTimer[i] = SetTimerEx("RaceTimer",1000,1,"i",i);
  332.             PlayerCheckTime[i] = gettime()+20;
  333.         }
  334.     }
  335.     return 1;
  336. }
  337. }
  338.  
  339. public OnPlayerEnterRaceCheckpoint(playerid)
  340. {
  341.     if(IsRaceRunning == true)
  342.     {
  343.         DisablePlayerRaceCheckpoint(playerid);
  344.         Player_CheckPoint[playerid] ++;
  345.         if(Player_CheckPoint[playerid] < 158)
  346.         {
  347.             PlayerCheckTime[playerid] = gettime()+20;
  348.             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);
  349.         }
  350.         else if(Player_CheckPoint[playerid] == 158)
  351.         {
  352.             for(new i = 0; i < MAX_PLAYERS; i++)
  353.             {
  354.                 if(IsInRace[i] == true)
  355.                 {
  356.                     DisablePlayerRaceCheckpoint(i);
  357.                     SetPlayerPos(i,-2804.5796,-472.9876,7.1875);// CoorDs Outside
  358.                     IsInRace[i] = false;
  359.                 }
  360.             }
  361.             for(new i;i<RaceVehicles;i++)
  362.             {
  363.                 if(RacesVehicles[i] == GetPlayerVehicleID(playerid))
  364.                 {
  365.                     DestroyVehicle(RacesVehicles[i]);
  366.                     RacesVehicles[i] = 0;
  367.                 }
  368.             }
  369.             GetPlayerName(playerid,WinnerName,sizeof(WinnerName));
  370.             if(!strlen(ThreeWinner[0]))format(ThreeName[0],MAX_PLAYER_NAME,WinnerName);
  371.             else if(!strlen(ThreeWinner[1]))format(ThreeName[1],MAX_PLAYER_NAME,WinnerName);
  372.             else if(!strlen(ThreeWinner[2]))format(ThreeName[2],MAX_PLAYER_NAME,WinnerName);
  373.             format(stringwin,sizeof(stringwin),"[RACE] The race is over, %s has won and achieved $%d!",ThreeWinner[0],winner_money);
  374.             SendClientMessageToAll(0xFF0000FF,stringwin);
  375.             GivePlayerMoney(GetIDofName(ThreeWinner[0]),10000);
  376.             GivePlayerMoney(GetIDofName(ThreeWinner[1]),9000);
  377.             GivePlayerMoney(GetIDofName(ThreeWinner[2]),8000);
  378.             IsRaceStart = false;
  379.             return 1;
  380.         }
  381.     }
  382.     return 1;
  383. }
  384. public OnPlayerConnect(playerid)
  385. {
  386.     // Credits and Start Place
  387.     Player_CheckPoint[playerid] = 0;
  388.     SetPlayerRaceCheckpoint(playerid,0,CheckPoints[0][0],CheckPoints[0][1],CheckPoints[0][2],CheckPoints[1][0],CheckPoints[1][1],CheckPoints[1][2],9.7);
  389.     IsRaceRunning = true;
  390.     return 1;
  391. }
  392.  
  393. forward RaceTimer(playerid);
  394. public RaceTimer(playerid)
  395. {
  396.     if(gettime() > PlayerCheckTime[playerid])
  397.     {
  398.         for(new i;i<RaceVehicles;i++)
  399.         {
  400.             if(RacesVehicles[i] == GetPlayerVehicleID(playerid))
  401.             {
  402.                 RacesVehicles[i] = 0;
  403.                 break;
  404.             }
  405.         }
  406.         DestroyVehicle(GetPlayerVehicleID(playerid));
  407.         IsInRace[playerid] = false;
  408.         KillTimer(PlayerRaceTimer[playerid]);
  409.         SetPlayerPos(playerid,-2804.5796,-472.9876,7.1875);//CoorDs Outside
  410.     }
  411.     return 1;
  412. }
  413.  
  414. stock GetIDofName(name_[])
  415. {
  416.     new get_name[MAX_PLAYER_NAME];
  417.     for(new i;i<MAX_PLAYERS;i++)
  418.     {
  419.         if(!GetPlayerName(i,get_name,MAX_PLAYER_NAME))return -1;
  420.         if(!strcmp(get_name,name_,false))return i;
  421.     }
  422.     return -1;
  423. }
Advertisement
RAW Paste Data Copied
Advertisement