Advertisement
Guest User

Untitled

a guest
Jul 10th, 2015
277
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 118.05 KB | None | 0 0
  1.  
  2.  
  3. #include <a_samp>
  4.  
  5. #define FILTERSCRIPT
  6.  
  7. //These are the coordinates your player will spawn at if they are still alive at the end of a minigame:
  8.  
  9. #define spawnX 1310.000000
  10. #define spawnY -1370.199951
  11. #define spawnZ 13.500000
  12.  
  13. new playerinminigame[MAX_PLAYERS];
  14.  
  15. new bloodring[15],derbyon,derbyplaying,playercarid[MAX_PLAYERS],playerinderby[MAX_PLAYERS],derbyrank,reward,bloodringfull[15],playerinbloodring[MAX_PLAYERS];
  16.  
  17. new tdmon,tdmplaying,playerintdm[MAX_PLAYERS],tdmrank,redplayers,blueplayers,tdmcolor,oldplayercolor[MAX_PLAYERS];
  18.  
  19. new dmon,dmplaying,playerindm[MAX_PLAYERS],dmrank;
  20.  
  21. new qbloodring[15],qbloodringfull[15],playerinqderby[MAX_PLAYERS],playerinqbloodring[MAX_PLAYERS],qderbyrank,qderbyon,qderbyplaying;
  22.  
  23. new boxon,boxplaying,playerinbox[MAX_PLAYERS],boxrank;
  24.  
  25. new sdon,sdplaying,playerinsd[MAX_PLAYERS],sdrank,sdfirst;
  26.  
  27. new karts[15],kartfull[15],karton,kartplaying,playerinkartrace[MAX_PLAYERS],kartrank,playerinkart[MAX_PLAYERS],currentcheckpoint[MAX_PLAYERS],krtfirst;
  28.  
  29. new nrg[15],nrgfull[15],sron,srplaying,playerinsr[MAX_PLAYERS],srrank,playerinnrg[MAX_PLAYERS],currentracecheckpoint[MAX_PLAYERS],srfirst;
  30.  
  31. new startvar[8];
  32.  
  33. //Timers:
  34.  
  35. new dtimer,dmtimer,tdmtimer,qdtimer,boxtimer,sdtimer,krttimer,srtimer;
  36.  
  37. forward PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z);
  38. forward load();
  39.  
  40. forward Spawnbloodrings();// Derby
  41. forward Destroybloodrings();
  42. forward Respawnbloodrings();
  43. forward StartDerby();
  44.  
  45. forward Starttdm();// TeamDM
  46.  
  47. forward Startdm();// LVDM
  48.  
  49. forward Spawnqbloodrings();// Quarry Derby
  50. forward Destroyqbloodrings();
  51. forward Respawnqbloodrings();
  52. forward StartqDerby();
  53.  
  54. forward StartBox();// Boxing Fight
  55.  
  56. forward StartSd();// Skydive
  57. forward EndSd();
  58. forward SdFinish(playerid);
  59.  
  60. forward SpawnKarts();// KartRace
  61. forward DestroyKarts();
  62. forward RespawnKarts();
  63. forward StartKart();
  64. forward KrtFinish();
  65.  
  66. forward SpawnNrgs();// Stadium Race
  67. forward DestroyNrgs();
  68. forward RespawnNrgs();
  69. forward StartSr();
  70. forward SrFinish();
  71.  
  72. forward RewardCalc(playerid,min,max);// General reward calc.
  73.  
  74.  
  75. // Derby cars:
  76. new Float:derbycars[15][4] = {
  77. {-1362.9799,932.8219,1036.0580,9.0890}, // 0
  78. {-1346.4526,935.4996,1036.0889,13.6811}, // 1
  79. {-1335.6995,938.2600,1036.1177,16.8043}, // 2
  80. {-1320.8756,944.9904,1036.2062,27.0307}, // 3
  81. {-1306.8385,953.5919,1036.3212,37.8366}, // 4
  82. {-1353.9670,934.0486,1036.2421,11.5836}, // 5
  83. {-1328.6377,941.0197,1036.3208,18.9670}, // 6
  84. {-1313.9012,948.6513,1036.4198,29.5596}, // 7
  85. {-1501.0956,960.3203,1036.9474,313.0457}, // 8
  86. {-1506.8105,968.1082,1037.0840,304.3027}, // 9
  87. {-1513.0317,976.8713,1037.2457,301.9500}, // 10
  88. {-1516.0858,988.2343,1037.4362,274.5044}, // 11
  89. {-1517.6569,995.6628,1037.5626,272.2782}, // 12
  90. {-1515.1127,1004.8807,1037.6969,262.3869}, // 13
  91. {-1510.7020,1014.6202,1037.8568,249.1825} // 14
  92. };
  93.  
  94.  
  95. // LVDM Spawn places:
  96. new Float:lvdmspawns[15][3] = {
  97. {2297.5220,2484.1804,3.2734}, // 0
  98. {2271.5120,2474.2268,3.2734}, // 1
  99. {2244.7441,2467.5762,3.2734}, // 2
  100. {2248.0867,2448.3484,3.2734}, // 3
  101. {2267.7366,2439.3997,3.2734}, // 4
  102. {2286.3911,2434.0715,3.2734}, // 5
  103. {2302.9141,2441.9189,3.2734}, // 6
  104. {2265.5151,2494.8433,-0.3329}, // 7
  105. {2300.1218,2483.3733,-7.4531}, // 8
  106. {2281.1760,2480.1216,-7.4531}, // 9
  107. {2251.8474,2473.7490,-7.4531}, // 10
  108. {2227.2383,2460.1196,-7.4531}, // 11
  109. {2250.4229,2440.2544,-7.4531}, // 12
  110. {2293.2231,2438.4878,-7.4531}, // 13
  111. {2301.3645,2452.4045,-7.4531} // 14
  112. };
  113.  
  114. // Quarry derby cars:
  115. new Float:qderbycars[15][4] = {
  116. {605.7057,815.2199,-43.1692,350.9785}, // 0
  117. {609.4918,814.6188,-43.1692,350.9785}, // 1
  118. {613.3760,814.0021,-43.1692,350.9785}, // 2
  119. {616.5115,813.5043,-43.1692,350.9785}, // 3
  120. {619.8624,812.9723,-43.1691,350.9785}, // 4
  121. {622.9971,812.4746,-43.1691,350.9785}, // 5
  122. {678.2766,922.8008,-41.0451,115.3092}, // 6
  123. {680.1019,918.9395,-41.0066,115.3092}, // 7
  124. {681.3400,916.3724,-40.6739,115.2029}, // 8
  125. {682.7889,913.2912,-40.3585,115.2062}, // 9
  126. {491.2690,912.7574,-30.6622,248.8228}, // 10
  127. {489.9630,909.3635,-30.6003,248.8228}, // 11
  128. {488.5172,905.6060,-30.5318,248.8228}, // 12
  129. {488.1009,902.4600,-30.4778,262.3300}, // 13
  130. {487.7645,899.9181,-30.4341,262.3300} // 14
  131. };
  132.  
  133. // Karts:
  134. new Float:kartspawns[15][4] = {
  135. {-1366.1909,906.8451,1040.5919,280.3004}, // 0
  136. {-1366.4854,908.3992,1040.2843,280.3004}, // 1
  137. {-1366.8508,910.3288,1039.9022,280.3004}, // 2
  138. {-1367.2168,912.2613,1039.5195,280.3004}, // 3
  139. {-1367.7562,915.1094,1038.9557,280.3004}, // 4
  140. {-1368.4265,918.6667,1038.4503,280.3231}, // 5
  141. {-1368.8036,920.6827,1038.1428,280.3231}, // 6
  142. {-1369.1410,922.4866,1037.8677,280.3231}, // 7
  143. {-1372.5338,921.9490,1037.9705,277.8816}, // 8
  144. {-1372.2379,919.8677,1038.2872,277.8816}, // 9
  145. {-1371.9086,917.5515,1038.6396,277.8816}, // 10
  146. {-1371.6196,915.5192,1038.9486,277.8816}, // 11
  147. {-1371.2595,912.9866,1039.3340,277.8816}, // 12
  148. {-1371.0453,911.4792,1039.5632,277.8816}, // 13
  149. {-1370.6086,908.9531,1040.1785,275.7079} // 14
  150. };
  151.  
  152. new Float:nrgspawns[15][4] = {
  153. {-1436.5146,-595.6609,1055.5591,86.0952},
  154. {-1436.4534,-594.7911,1055.4529,86.1336},
  155. {-1436.3988,-594.0178,1055.3585,86.1336},
  156. {-1436.3256,-592.9784,1055.2316,86.1336},
  157. {-1436.2520,-591.9318,1055.1398,86.1124},
  158. {-1436.1643,-590.6272,1055.0952,86.1436},
  159. {-1436.1060,-589.7750,1055.0508,86.1436},
  160. {-1436.0160,-588.4620,1054.9822,86.1436},
  161. {-1435.9694,-587.7808,1054.9465,86.1436},
  162. {-1435.9060,-586.8561,1054.8982,86.1436},
  163. {-1435.8304,-586.0049,1054.8535,85.9079},
  164. {-1435.7190,-584.4737,1054.7749,85.9079},
  165. {-1435.6482,-583.4991,1054.7249,85.9079},
  166. {-1435.5737,-582.4772,1054.6724,85.9079},
  167. {-1435.4778,-581.1537,1054.5422,85.8982}
  168. };
  169.  
  170. // Kartrace checkpoints:
  171. new Float:kcps[5][3] = {
  172. {-1262.4230,1028.3113,1039.6948},
  173. {-1433.8792,1083.7178,1039.0344},
  174. {-1540.4967,1004.6923,1039.1409},
  175. {-1392.7269,914.2321,1039.8306},
  176. {-1392.7269,914.2321,1039.8306}
  177. };
  178.  
  179. new Float:srcps[10][3] = {
  180. {-1515.0345,-646.2552,1049.8767},
  181. {-1379.9943,-743.5076,1051.6895},
  182. {-1373.9252,-665.4581,1055.8362},
  183. {-1477.3721,-616.7951,1053.4919},
  184. {-1437.9470,-669.4881,1053.0645},
  185. {-1382.3152,-722.2056,1055.6273},
  186. {-1335.7629,-637.1422,1054.2230},
  187. {-1386.6233,-589.4922,1056.3871},
  188. {-1421.6000,-588.1021,1055.8623},
  189. {-1421.6000,-588.1021,1055.8623}
  190. };
  191.  
  192.  
  193. #if defined FILTERSCRIPT
  194.  
  195. public OnFilterScriptInit()
  196. {
  197. SetTimer("load",2000,0);
  198. return 1;
  199. }
  200.  
  201. public OnFilterScriptExit()
  202. {
  203. Destroybloodrings();
  204. Destroyqbloodrings();
  205. DestroyKarts();
  206. DestroyNrgs();
  207. return 1;
  208. }
  209.  
  210. #endif
  211.  
  212. public OnGameModeInit()
  213. {
  214. SetTimer("load",2000,0);
  215. return 1;
  216. }
  217.  
  218. public OnGameModeExit()
  219. {
  220. Destroybloodrings();
  221. Destroyqbloodrings();
  222. DestroyKarts();
  223. DestroyNrgs();
  224. return 1;
  225. }
  226.  
  227. public OnPlayerRequestClass(playerid, classid)
  228. {
  229. return 1;
  230. }
  231.  
  232. public OnPlayerRequestSpawn(playerid)
  233. {
  234. return 1;
  235. }
  236.  
  237. public OnPlayerConnect(playerid)
  238. {
  239. playerinminigame[playerid] = 0; // Checks if a player is in a minigame
  240. playercarid[playerid] = -1; // Car that player currently is in, used to check whether the player is in a derby/race car
  241.  
  242. playerinderby[playerid] = 0; // Derby
  243. playerinbloodring[playerid] = -1;
  244.  
  245. playerintdm[playerid] = 0; // TeamDM
  246.  
  247. playerindm[playerid] = 0; // LVDM
  248.  
  249. playerinqderby[playerid] = 0; // Quarry Derby
  250. playerinqbloodring[playerid] = -1;
  251.  
  252. playerinbox[playerid] = 0; // Boxing Fight
  253.  
  254. playerinkartrace[playerid] = 0; // Kart Race
  255. playerinkart[playerid] = -1;
  256. currentcheckpoint[playerid] = 0;
  257. return 1;
  258. }
  259.  
  260. public OnPlayerDisconnect(playerid, reason)
  261. {
  262. new string[256];
  263. if(playerinderby[playerid] == 1)
  264. {
  265. new DerbyPlayerName[MAX_PLAYER_NAME];
  266. GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
  267. format(string, sizeof(string), "%s has been dropped out of the derby, rank: %d", DerbyPlayerName, derbyrank);
  268. SendClientMessageToAll(0x33AA33AA, string);
  269. playerinderby[playerid] = 0;
  270. playerinminigame[playerid] = 0;
  271. bloodringfull[playerinbloodring[playerid]] = 0;
  272. playerinbloodring[playerid] = -1;
  273. if(derbyrank <= 2)
  274. {
  275. for(new i=0; i<MAX_PLAYERS; i++)
  276. {
  277. if (IsPlayerConnected(i) && playerinderby[i] == 1)
  278. {
  279. new winnername[256];
  280. GetPlayerName(i,winnername, sizeof(winnername));
  281. RewardCalc(i,100,1000);
  282. format(string, sizeof(string), "%s has won the derby for $%d", winnername, reward);
  283. SendClientMessageToAll(0x33AA33AA, string);
  284. GivePlayerMoney(i,reward);
  285. playerinderby[i] = 0;
  286. playerinminigame[i] = 0;
  287. SetPlayerVirtualWorld(i,0);
  288. SetPlayerInterior(playerid, 0);
  289. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  290. }
  291. }
  292. derbyplaying = 0;
  293. derbyrank = 0;
  294. derbyon = 0;
  295. KillTimer(dtimer);
  296. Respawnbloodrings();
  297. return 1;
  298. }
  299. derbyrank--;
  300. } else if(playerintdm[playerid] == 1) {
  301. new tdmPlayerName[MAX_PLAYER_NAME];
  302. GetPlayerName(playerid, tdmPlayerName, sizeof(tdmPlayerName));
  303. if(GetPlayerColor(playerid) == 0x0000BBAA)
  304. {
  305. format(string, sizeof(string), "%s has been dropped out of the team DM, team blue", tdmPlayerName);
  306. blueplayers = blueplayers-1;
  307. } else {
  308. format(string, sizeof(string), "%s has been dropped out of the team DM, team red", tdmPlayerName);
  309. redplayers = redplayers-1;
  310. }
  311. SendClientMessageToAll(0x33AA33AA, string);
  312. playerintdm[playerid] = 0;
  313. playerinminigame[playerid] = 0;
  314. if(tdmrank == 0)
  315. {
  316. tdmplaying = 0;
  317. tdmrank = 0;
  318. tdmon = 0;
  319. KillTimer(tdmtimer);
  320. return 1;
  321. }
  322. if((blueplayers == 0 || redplayers == 0) && tdmplaying == 1)
  323. {
  324. if(blueplayers == 0)
  325. {
  326. format(string, sizeof(string), "Team red has won the team DM");
  327. } else if(redplayers == 0)
  328. {
  329. format(string, sizeof(string), "Team blue has won the team DM");
  330. }
  331. SendClientMessageToAll(0x33AA33AA, string);
  332. for(new i=0; i<MAX_PLAYERS; i++)
  333. {
  334. if (IsPlayerConnected(i) && playerintdm[i] == 1)
  335. {
  336. playerintdm[i] = 0;
  337. playerinminigame[i] = 0;
  338. SetPlayerVirtualWorld(i,0);
  339. SetPlayerInterior(playerid, 0);
  340. SetPlayerColor(i,oldplayercolor[i]);
  341. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  342. }
  343. }
  344. tdmplaying = 0;
  345. tdmrank = 0;
  346. tdmon = 0;
  347. KillTimer(tdmtimer);
  348. return 1;
  349. }
  350. tdmrank--;
  351. } else if(playerindm[playerid] == 1) {
  352. new dmPlayerName[MAX_PLAYER_NAME];
  353. GetPlayerName(playerid, dmPlayerName, sizeof(dmPlayerName));
  354. format(string, sizeof(string), "%s has been dropped out of the LVDM, rank: %d", dmPlayerName, dmrank);
  355. SendClientMessageToAll(0x33AA33AA, string);
  356. playerindm[playerid] = 0;
  357. playerinminigame[playerid] = 0;
  358. if(dmrank <= 2)
  359. {
  360. for(new i=0; i<MAX_PLAYERS; i++)
  361. {
  362. if (IsPlayerConnected(i) && playerindm[i] == 1)
  363. {
  364. new dmwinnername[256];
  365. GetPlayerName(i,dmwinnername, sizeof(dmwinnername));
  366. RewardCalc(i,100,1000);
  367. format(string, sizeof(string), "%s has won the LVDM for $%d", dmwinnername, reward);
  368. SendClientMessageToAll(0x33AA33AA, string);
  369. GivePlayerMoney(i,reward);
  370. playerindm[i] = 0;
  371. playerinminigame[i] = 0;
  372. SetPlayerVirtualWorld(i,0);
  373. SetPlayerInterior(playerid, 0);
  374. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  375. }
  376. }
  377. dmplaying = 0;
  378. dmrank = 0;
  379. dmon = 0;
  380. KillTimer(dmtimer);
  381. return 1;
  382. }
  383. dmrank--;
  384. } else if(playerinqderby[playerid] == 1) {
  385. new DerbyPlayerName[MAX_PLAYER_NAME];
  386. GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
  387. format(string, sizeof(string), "%s has been dropped out of the quarry derby, rank: %d", DerbyPlayerName, qderbyrank);
  388. SendClientMessageToAll(0x33AA33AA, string);
  389. playerinqderby[playerid] = 0;
  390. playerinminigame[playerid] = 0;
  391. qbloodringfull[playerinqbloodring[playerid]] = 0;
  392. playerinqbloodring[playerid] = -1;
  393. if(qderbyrank <= 2)
  394. {
  395. for(new i=0; i<MAX_PLAYERS; i++)
  396. {
  397. if (IsPlayerConnected(i) && playerinqderby[i] == 1)
  398. {
  399. new winnername[256];
  400. GetPlayerName(i,winnername, sizeof(winnername));
  401. RewardCalc(i,100,1000);
  402. format(string, sizeof(string), "%s has won the quarry derby for $%d", winnername, reward);
  403. SendClientMessageToAll(0x33AA33AA, string);
  404. GivePlayerMoney(i,reward);
  405. playerinqderby[i] = 0;
  406. playerinminigame[i] = 0;
  407. SetPlayerVirtualWorld(i,0);
  408. SetPlayerInterior(playerid, 0);
  409. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  410. }
  411. }
  412. qderbyplaying = 0;
  413. qderbyrank = 0;
  414. qderbyon = 0;
  415. KillTimer(qdtimer);
  416. Respawnqbloodrings();
  417. return 1;
  418. }
  419. qderbyrank--;
  420. } else if(playerinbox[playerid] == 1) {
  421. new boxPlayerName[MAX_PLAYER_NAME];
  422. GetPlayerName(playerid, boxPlayerName, sizeof(boxPlayerName));
  423. format(string, sizeof(string), "%s has been dropped out of the boxing fight, rank: %d", boxPlayerName, boxrank);
  424. SendClientMessageToAll(0x33AA33AA, string);
  425. playerinbox[playerid] = 0;
  426. playerinminigame[playerid] = 0;
  427. if(boxrank <= 2)
  428. {
  429. for(new i=0; i<MAX_PLAYERS; i++)
  430. {
  431. if (IsPlayerConnected(i) && playerinbox[i] == 1)
  432. {
  433. new boxwinnername[256];
  434. GetPlayerName(i,boxwinnername, sizeof(boxwinnername));
  435. RewardCalc(i,100,1000);
  436. format(string, sizeof(string), "%s has won the boxing fight for $%d", boxwinnername, reward);
  437. SendClientMessageToAll(0x33AA33AA, string);
  438. GivePlayerMoney(i,reward);
  439. playerinbox[i] = 0;
  440. playerinminigame[i] = 0;
  441. SetPlayerVirtualWorld(i,0);
  442. SetPlayerInterior(playerid, 0);
  443. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  444. }
  445. }
  446. boxplaying = 0;
  447. boxrank = 0;
  448. boxon = 0;
  449. KillTimer(boxtimer);
  450. return 1;
  451. }
  452. boxrank--;
  453. } else if(playerinsd[playerid] == 1) {
  454. new SkydivePlayerName[MAX_PLAYER_NAME];
  455. GetPlayerName(playerid, SkydivePlayerName, sizeof(SkydivePlayerName));
  456. format(string, sizeof(string), "%s has been dropped out of the skydive", SkydivePlayerName);
  457. SendClientMessageToAll(0x33AA33AA, string);
  458. playerinsd[playerid] = 0;
  459. playerinminigame[playerid] = 0;
  460. if(sdrank <= 1)
  461. {
  462. for(new i=0; i<MAX_PLAYERS; i++)
  463. {
  464. if (IsPlayerConnected(i) && playerinsd[i] == 1)
  465. {
  466. playerinsd[i] = 0;
  467. playerinminigame[i] = 0;
  468. SetPlayerVirtualWorld(i,0);
  469. SetPlayerInterior(playerid, 0);
  470. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  471. }
  472. }
  473. sdplaying = 0;
  474. sdrank = 0;
  475. sdon = 0;
  476. sdfirst = 0;
  477. KillTimer(sdtimer);
  478. return 1;
  479. }
  480. sdrank--;
  481. } else if(playerinkartrace[playerid] == 1) {
  482. new KartPlayerName[MAX_PLAYER_NAME];
  483. GetPlayerName(playerid, KartPlayerName, sizeof(KartPlayerName));
  484. format(string, sizeof(string), "%s has been dropped out of the kart race", KartPlayerName);
  485. SendClientMessageToAll(0x33AA33AA, string);
  486. playerinkartrace[playerid] = 0;
  487. playerinminigame[playerid] = 0;
  488. kartfull[playerinkart[playerid]] = 0;
  489. playerinkart[playerid] = -1;
  490. if(kartrank <= 1)
  491. {
  492. for(new i=0; i<MAX_PLAYERS; i++)
  493. {
  494. if (IsPlayerConnected(i) && playerinkartrace[i] == 1)
  495. {
  496. playerinkartrace[i] = 0;
  497. playerinminigame[i] = 0;
  498. SetPlayerVirtualWorld(i,0);
  499. SetPlayerInterior(playerid, 0);
  500. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  501. }
  502. }
  503. kartplaying = 0;
  504. kartrank = 0;
  505. karton = 0;
  506. KillTimer(krttimer);
  507. RespawnKarts();
  508. return 1;
  509. }
  510. kartrank--;
  511. } else if(playerinsr[playerid] == 1) {
  512. new SrPlayerName[MAX_PLAYER_NAME];
  513. GetPlayerName(playerid, SrPlayerName, sizeof(SrPlayerName));
  514. format(string, sizeof(string), "%s has been dropped out of the stadium race", SrPlayerName);
  515. SendClientMessageToAll(0x33AA33AA, string);
  516. playerinsr[playerid] = 0;
  517. playerinminigame[playerid] = 0;
  518. nrgfull[playerinnrg[playerid]] = 0;
  519. playerinnrg[playerid] = -1;
  520. if(kartrank <= 1)
  521. {
  522. for(new i=0; i<MAX_PLAYERS; i++)
  523. {
  524. if (IsPlayerConnected(i) && playerinsr[i] == 1)
  525. {
  526. playerinsr[i] = 0;
  527. playerinminigame[i] = 0;
  528. SetPlayerVirtualWorld(i,0);
  529. SetPlayerInterior(playerid, 0);
  530. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  531. }
  532. }
  533. kartplaying = 0;
  534. kartrank = 0;
  535. karton = 0;
  536. KillTimer(srtimer);
  537. RespawnNrgs();
  538. return 1;
  539. }
  540. srrank--;
  541. }
  542. return 1;
  543. }
  544.  
  545. public OnPlayerSpawn(playerid)
  546. {
  547. return 1;
  548. }
  549.  
  550. public OnPlayerDeath(playerid, killerid, reason)
  551. {
  552. new string[256];
  553. if(playerinderby[playerid] == 1)
  554. {
  555. new DerbyPlayerName[MAX_PLAYER_NAME];
  556. GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
  557. format(string, sizeof(string), "%s has been dropped out of the derby, rank: %d", DerbyPlayerName, derbyrank);
  558. SendClientMessageToAll(0x33AA33AA, string);
  559. playerinderby[playerid] = 0;
  560. playerinminigame[playerid] = 0;
  561. bloodringfull[playerinbloodring[playerid]] = 0;
  562. playerinbloodring[playerid] = -1;
  563. if(derbyrank <= 2)
  564. {
  565. for(new i=0; i<MAX_PLAYERS; i++)
  566. {
  567. if (IsPlayerConnected(i) && playerinderby[i] == 1)
  568. {
  569. new winnername[256];
  570. GetPlayerName(i,winnername, sizeof(winnername));
  571. RewardCalc(i,100,1000);
  572. format(string, sizeof(string), "%s has won the derby for $%d", winnername, reward);
  573. SendClientMessageToAll(0x33AA33AA, string);
  574. GivePlayerMoney(i,reward);
  575. playerinderby[i] = 0;
  576. playerinminigame[i] = 0;
  577. SetPlayerVirtualWorld(i,0);
  578. SetPlayerInterior(playerid, 0);
  579. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  580. }
  581. }
  582. derbyplaying = 0;
  583. derbyrank = 0;
  584. derbyon = 0;
  585. KillTimer(dtimer);
  586. Respawnbloodrings();
  587. return 1;
  588. }
  589. derbyrank--;
  590. } else if(playerintdm[playerid] == 1) {
  591. new tdmPlayerName[MAX_PLAYER_NAME];
  592. GetPlayerName(playerid, tdmPlayerName, sizeof(tdmPlayerName));
  593. if(GetPlayerColor(playerid) == 0x0000BBAA)
  594. {
  595. format(string, sizeof(string), "%s has been dropped out of the team DM, team blue", tdmPlayerName);
  596. blueplayers = blueplayers-1;
  597. } else {
  598. format(string, sizeof(string), "%s has been dropped out of the team DM, team red", tdmPlayerName);
  599. redplayers = redplayers-1;
  600. }
  601. SendClientMessageToAll(0x33AA33AA, string);
  602. playerintdm[playerid] = 0;
  603. playerinminigame[playerid] = 0;
  604. if(tdmrank == 0)
  605. {
  606. tdmplaying = 0;
  607. tdmrank = 0;
  608. tdmon = 0;
  609. KillTimer(tdmtimer);
  610. return 1;
  611. }
  612. if((blueplayers == 0 || redplayers == 0) && tdmplaying == 1)
  613. {
  614. if(blueplayers == 0)
  615. {
  616. format(string, sizeof(string), "Team red has won the team DM");
  617. } else if(redplayers == 0)
  618. {
  619. format(string, sizeof(string), "Team blue has won the team DM");
  620. }
  621. SendClientMessageToAll(0x33AA33AA, string);
  622. for(new i=0; i<MAX_PLAYERS; i++)
  623. {
  624. if (IsPlayerConnected(i) && playerintdm[i] == 1)
  625. {
  626. playerintdm[i] = 0;
  627. playerinminigame[i] = 0;
  628. SetPlayerVirtualWorld(i,0);
  629. SetPlayerInterior(playerid, 0);
  630. SetPlayerColor(i,oldplayercolor[i]);
  631. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  632. }
  633. }
  634. tdmplaying = 0;
  635. tdmrank = 0;
  636. tdmon = 0;
  637. KillTimer(tdmtimer);
  638. return 1;
  639. }
  640. tdmrank--;
  641. } else if(playerindm[playerid] == 1) {
  642. new dmPlayerName[MAX_PLAYER_NAME];
  643. GetPlayerName(playerid, dmPlayerName, sizeof(dmPlayerName));
  644. format(string, sizeof(string), "%s has been dropped out of the LVDM, rank: %d", dmPlayerName, dmrank);
  645. SendClientMessageToAll(0x33AA33AA, string);
  646. playerindm[playerid] = 0;
  647. playerinminigame[playerid] = 0;
  648. if(dmrank <= 2)
  649. {
  650. for(new i=0; i<MAX_PLAYERS; i++)
  651. {
  652. if (IsPlayerConnected(i) && playerindm[i] == 1)
  653. {
  654. new dmwinnername[256];
  655. GetPlayerName(i,dmwinnername, sizeof(dmwinnername));
  656. RewardCalc(i,100,1000);
  657. format(string, sizeof(string), "%s has won the LVDM for $%d", dmwinnername, reward);
  658. SendClientMessageToAll(0x33AA33AA, string);
  659. GivePlayerMoney(i,reward);
  660. playerindm[i] = 0;
  661. playerinminigame[i] = 0;
  662. SetPlayerVirtualWorld(i,0);
  663. SetPlayerInterior(playerid, 0);
  664. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  665. }
  666. }
  667. dmplaying = 0;
  668. dmrank = 0;
  669. dmon = 0;
  670. KillTimer(dmtimer);
  671. return 1;
  672. }
  673. dmrank--;
  674. } else if(playerinqderby[playerid] == 1) {
  675. new DerbyPlayerName[MAX_PLAYER_NAME];
  676. GetPlayerName(playerid, DerbyPlayerName, sizeof(DerbyPlayerName));
  677. format(string, sizeof(string), "%s has been dropped out of the quarry derby, rank: %d", DerbyPlayerName, qderbyrank);
  678. SendClientMessageToAll(0x33AA33AA, string);
  679. playerinqderby[playerid] = 0;
  680. playerinminigame[playerid] = 0;
  681. qbloodringfull[playerinqbloodring[playerid]] = 0;
  682. playerinqbloodring[playerid] = -1;
  683. if(qderbyrank <= 2)
  684. {
  685. for(new i=0; i<MAX_PLAYERS; i++)
  686. {
  687. if (IsPlayerConnected(i) && playerinqderby[i] == 1)
  688. {
  689. new winnername[256];
  690. GetPlayerName(i,winnername, sizeof(winnername));
  691. RewardCalc(i,100,1000);
  692. format(string, sizeof(string), "%s has won the quarry derby for $%d", winnername, reward);
  693. SendClientMessageToAll(0x33AA33AA, string);
  694. GivePlayerMoney(i,reward);
  695. playerinqderby[i] = 0;
  696. playerinminigame[i] = 0;
  697. SetPlayerVirtualWorld(i,0);
  698. SetPlayerInterior(playerid, 0);
  699. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  700. }
  701. }
  702. qderbyplaying = 0;
  703. qderbyrank = 0;
  704. qderbyon = 0;
  705. KillTimer(qdtimer);
  706. Respawnqbloodrings();
  707. return 1;
  708. }
  709. qderbyrank--;
  710. } else if(playerinbox[playerid] == 1) {
  711. new boxPlayerName[MAX_PLAYER_NAME];
  712. GetPlayerName(playerid, boxPlayerName, sizeof(boxPlayerName));
  713. format(string, sizeof(string), "%s has been dropped out of the boxing fight, rank: %d", boxPlayerName, boxrank);
  714. SendClientMessageToAll(0x33AA33AA, string);
  715. playerinbox[playerid] = 0;
  716. playerinminigame[playerid] = 0;
  717. if(boxrank <= 2)
  718. {
  719. for(new i=0; i<MAX_PLAYERS; i++)
  720. {
  721. if (IsPlayerConnected(i) && playerinbox[i] == 1)
  722. {
  723. new boxwinnername[256];
  724. GetPlayerName(i,boxwinnername, sizeof(boxwinnername));
  725. RewardCalc(i,100,1000);
  726. format(string, sizeof(string), "%s has won the boxing fight for $%d", boxwinnername, reward);
  727. SendClientMessageToAll(0x33AA33AA, string);
  728. GivePlayerMoney(i,reward);
  729. playerinbox[i] = 0;
  730. playerinminigame[i] = 0;
  731. SetPlayerVirtualWorld(i,0);
  732. SetPlayerInterior(playerid, 0);
  733. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  734. }
  735. }
  736. boxplaying = 0;
  737. boxrank = 0;
  738. boxon = 0;
  739. KillTimer(boxtimer);
  740. return 1;
  741. }
  742. boxrank--;
  743. } else if(playerinsd[playerid] == 1) {
  744. new SkydivePlayerName[MAX_PLAYER_NAME];
  745. GetPlayerName(playerid, SkydivePlayerName, sizeof(SkydivePlayerName));
  746. format(string, sizeof(string), "%s has been dropped out of the skydive", SkydivePlayerName);
  747. SendClientMessageToAll(0x33AA33AA, string);
  748. playerinsd[playerid] = 0;
  749. playerinminigame[playerid] = 0;
  750. if(sdrank <= 1)
  751. {
  752. for(new i=0; i<MAX_PLAYERS; i++)
  753. {
  754. if (IsPlayerConnected(i) && playerinsd[i] == 1)
  755. {
  756. playerinsd[i] = 0;
  757. playerinminigame[i] = 0;
  758. SetPlayerVirtualWorld(i,0);
  759. SetPlayerInterior(playerid, 0);
  760. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  761. }
  762. }
  763. sdplaying = 0;
  764. sdrank = 0;
  765. sdon = 0;
  766. sdfirst = 0;
  767. KillTimer(sdtimer);
  768. return 1;
  769. }
  770. sdrank--;
  771. } else if(playerinkartrace[playerid] == 1) {
  772. new KartPlayerName[MAX_PLAYER_NAME];
  773. GetPlayerName(playerid, KartPlayerName, sizeof(KartPlayerName));
  774. format(string, sizeof(string), "%s has been dropped out of the kart race", KartPlayerName);
  775. SendClientMessageToAll(0x33AA33AA, string);
  776. playerinkartrace[playerid] = 0;
  777. playerinminigame[playerid] = 0;
  778. kartfull[playerinkart[playerid]] = 0;
  779. playerinkart[playerid] = -1;
  780. if(kartrank <= 1)
  781. {
  782. for(new i=0; i<MAX_PLAYERS; i++)
  783. {
  784. if (IsPlayerConnected(i) && playerinkartrace[i] == 1)
  785. {
  786. playerinkartrace[i] = 0;
  787. playerinminigame[i] = 0;
  788. SetPlayerVirtualWorld(i,0);
  789. SetPlayerInterior(playerid, 0);
  790. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  791. }
  792. }
  793. kartplaying = 0;
  794. kartrank = 0;
  795. karton = 0;
  796. KillTimer(krttimer);
  797. RespawnKarts();
  798. return 1;
  799. }
  800. kartrank--;
  801. } else if(playerinsr[playerid] == 1) {
  802. new SrPlayerName[MAX_PLAYER_NAME];
  803. GetPlayerName(playerid, SrPlayerName, sizeof(SrPlayerName));
  804. format(string, sizeof(string), "%s has been dropped out of the stadium race", SrPlayerName);
  805. SendClientMessageToAll(0x33AA33AA, string);
  806. playerinsr[playerid] = 0;
  807. playerinminigame[playerid] = 0;
  808. nrgfull[playerinnrg[playerid]] = 0;
  809. playerinnrg[playerid] = -1;
  810. if(kartrank <= 1)
  811. {
  812. for(new i=0; i<MAX_PLAYERS; i++)
  813. {
  814. if (IsPlayerConnected(i) && playerinsr[i] == 1)
  815. {
  816. playerinsr[i] = 0;
  817. playerinminigame[i] = 0;
  818. SetPlayerVirtualWorld(i,0);
  819. SetPlayerInterior(playerid, 0);
  820. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  821. }
  822. }
  823. srplaying = 0;
  824. srrank = 0;
  825. sron = 0;
  826. KillTimer(srtimer);
  827. RespawnNrgs();
  828. return 1;
  829. }
  830. srrank--;
  831. }
  832. return 1;
  833. }
  834.  
  835. public OnVehicleSpawn(vehicleid)
  836. {
  837. return 1;
  838. }
  839.  
  840. public OnVehicleDeath(vehicleid, killerid)
  841. {
  842. return 1;
  843. }
  844.  
  845. public OnPlayerText(playerid, text[])
  846. {
  847. return 1;
  848. }
  849.  
  850. public OnPlayerPrivmsg(playerid, recieverid, text[])
  851. {
  852. return 1;
  853. }
  854.  
  855. public OnPlayerCommandText(playerid, cmdtext[])
  856. {
  857. new cmd[256];
  858. new idx;
  859. new string[256];
  860. new tmp[256];
  861. cmd = strtok(cmdtext, idx);
  862.  
  863. if(strcmp(cmd, "/mark", true) == 0)
  864. {
  865. if(playerinminigame[playerid])
  866. {
  867. SendClientMessage(playerid, 0x33AA33AA, "To prevent abuse, /mark and /gotomark are disabled in minigames.");
  868. return 1;
  869. }
  870. }
  871.  
  872. if(strcmp(cmd, "/gotomark", true) == 0)
  873. {
  874. if(playerinminigame[playerid])
  875. {
  876. SendClientMessage(playerid, 0x33AA33AA, "To prevent abuse, /mark and /gotomark are disabled in minigames.");
  877. return 1;
  878. }
  879. }
  880.  
  881. if(strcmp(cmd, "/minigames", true) == 0)
  882. {
  883. SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
  884. SendClientMessage(playerid, 0xFF0000FF, " ");
  885. SendClientMessage(playerid, 0xFF0000FF, "These minigames are currently available:");
  886. SendClientMessage(playerid, 0xFF0000FF, "/derby /teamdm /lvdm /qderby /boxing /sdive /kartrace /srace");
  887. SendClientMessage(playerid, 0xFF0000FF, "Type /info for more information about seperate minigames.");
  888. SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
  889. return 1;
  890. }
  891.  
  892. if(strcmp(cmd, "/info", true) == 0)
  893. {
  894. tmp = strtok(cmdtext, idx);
  895. if(!strlen(tmp))
  896. {
  897. SendClientMessage(playerid,0xFFFF00AA, "Usage: /info [minigame command]");
  898. SendClientMessage(playerid,0xFFFF00AA, "Minigame commands: derby teamdm lvdm qderby boxing sdive kartrace srace");
  899. return 1;
  900. }
  901.  
  902. SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
  903. SendClientMessage(playerid, 0xFF0000FF, " ");
  904. if(strcmp(tmp, "derby", true) == 0){
  905. SendClientMessage(playerid, 0xFF0000FF, "Derby: A destruction derby in the Bloodbowl.");
  906. SendClientMessage(playerid, 0xFF0000FF, "Your goal is to destroy everyone other's car, and keep your own car intact.");
  907. }else if(strcmp(tmp, "teamdm", true) == 0){
  908. SendClientMessage(playerid, 0xFF0000FF, "TeamDM: A team deathmatch in area 51 with two teams, red and blue.");
  909. SendClientMessage(playerid, 0xFF0000FF, "Your goal is kill everyone of the other team.");
  910. }else if(strcmp(tmp, "lvdm", true) == 0){
  911. SendClientMessage(playerid, 0xFF0000FF, "Lvdm: A deathmatch in the LVPD.");
  912. SendClientMessage(playerid, 0xFF0000FF, "Your goal kill other people, and stay alive.");
  913. }else if(strcmp(tmp, "qderby", true) == 0){
  914. SendClientMessage(playerid, 0xFF0000FF, "QDerby: A destruction derby in the Quarry.");
  915. SendClientMessage(playerid, 0xFF0000FF, "Your goal is to destroy everyone other's car, and keep your own car intact.");
  916. }else if(strcmp(tmp, "boxing", true) == 0){
  917. SendClientMessage(playerid, 0xFF0000FF, "Boxing: A deathmatch without weapons, only fisting.");
  918. SendClientMessage(playerid, 0xFF0000FF, "Your goal kill other people, and stay alive.");
  919. }else if(strcmp(tmp, "sdive", true) == 0){
  920. SendClientMessage(playerid, 0xFF0000FF, "SDive: A skydive minigame.");
  921. SendClientMessage(playerid, 0xFF0000FF, "Your goal is to land on the tower as first. You must stay alive for 2 seconds there.");
  922. }else if(strcmp(tmp, "kartrace", true) == 0){
  923. SendClientMessage(playerid, 0xFF0000FF, "Kartrace: A race with karts around the Bloodbowl.");
  924. SendClientMessage(playerid, 0xFF0000FF, "Your goal is to drive two laps in the fastest time.");
  925. }else if(strcmp(tmp, "srace", true) == 0){
  926. SendClientMessage(playerid, 0xFF0000FF, "SRace: A race in the Vice Stadium, with NRG's.");
  927. SendClientMessage(playerid, 0xFF0000FF, "Your goal is to drive one lap in the fastest time.");
  928. }
  929. SendClientMessage(playerid, 0x33AA33AA, "______________________________________________________________________________");
  930. return 1;
  931. }
  932.  
  933. if(strcmp(cmd, "/derby", true) == 0)
  934. {
  935. if(derbyplaying == 1)
  936. {
  937. SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
  938. return 1;
  939. }
  940. if(playerinminigame[playerid] == 1)
  941. {
  942. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  943. return 1;
  944. }
  945. new pname[256];
  946. GetPlayerName(playerid, pname, 256);
  947. if(derbyon == 0)
  948. {
  949. derbyon = 1;
  950. playerinminigame[playerid] = 1;
  951. playerinderby[playerid] = 1;
  952. derbyrank = 1;
  953. SetPlayerInterior(playerid,15);
  954. SetPlayerVirtualWorld(playerid,7);
  955. SetVehicleVirtualWorld(bloodring[0],7);
  956. bloodringfull[0] = 1;
  957. PutPlayerInVehicle(playerid, bloodring[0], 0);
  958. playerinbloodring[playerid] = 0;
  959. TogglePlayerControllable(playerid, 0);
  960. startvar[0] = 1;
  961. dtimer = SetTimer("StartDerby", 60000, 0);
  962. format(string, sizeof(string), "%s has started a derby, you have one minute to type /derby and join", pname);//
  963. SendClientMessageToAll(0x33AA33AA,string);
  964. return 1;
  965. } else if(derbyon == 1 && derbyrank < 15) {
  966. playerinminigame[playerid] = 1;
  967. playerinderby[playerid] = 1;
  968. derbyrank++;
  969. SetPlayerInterior(playerid,15);
  970. for(new i=0; i<15; i++)
  971. {
  972. if(bloodringfull[i] == 0)
  973. {
  974. SetPlayerVirtualWorld(playerid,7);
  975. SetVehicleVirtualWorld(bloodring[i],7);
  976. bloodringfull[i] = 1;
  977. PutPlayerInVehicle(playerid, bloodring[i], 0);
  978. TogglePlayerControllable(playerid, 0);
  979. playerinbloodring[playerid] = i;
  980. format(string, sizeof(string), "%s has joined the derby", pname);//
  981. SendClientMessageToAll(0x33AA33AA,string);
  982. return 1;
  983. }
  984. }
  985. } else if(derbyon == 1 && derbyrank >= 15) {
  986. format(string, sizeof(string), "The derby is full, wait for the next round", pname);//
  987. SendClientMessage(playerid,0x33AA33AA,string);
  988. return 1;
  989. }
  990. }
  991.  
  992. if(strcmp(cmd, "/teamdm", true) == 0)
  993. {
  994. if(tdmplaying == 1)
  995. {
  996. SendClientMessage(playerid, 0xB4B5B7AA, "The team DM is already started");
  997. return 1;
  998. }
  999. if(playerinminigame[playerid] == 1)
  1000. {
  1001. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1002. return 1;
  1003. }
  1004. new pname[256];
  1005. GetPlayerName(playerid, pname, 256);
  1006. if(tdmon == 0)
  1007. {
  1008. tdmon = 1;
  1009. playerintdm[playerid] = 1;
  1010. playerinminigame[playerid] = 1;
  1011. tdmrank = 1;
  1012. TogglePlayerControllable(playerid, 0);
  1013. SetPlayerInterior(playerid,0);
  1014. SetPlayerVirtualWorld(playerid,7);
  1015. SetPlayerPos(playerid,208.8376,1863.5388,13.1406);
  1016. ResetPlayerWeapons(playerid);
  1017. GivePlayerWeapon(playerid,26,50000);
  1018. GivePlayerWeapon(playerid,31,50000);
  1019. GivePlayerWeapon(playerid,32,50000);
  1020. SetPlayerHealth(playerid,100);
  1021. SetPlayerArmour(playerid,100);
  1022. oldplayercolor[playerid] = GetPlayerColor(playerid);
  1023. SetPlayerColor(playerid,0x0000BBAA);// BLUE
  1024. blueplayers = 1;
  1025. redplayers = 0;
  1026. tdmcolor = 1;
  1027. startvar[1] = 1;
  1028. tdmtimer = SetTimer("Starttdm", 60000, 0);
  1029. format(string, sizeof(string), "%s has started a team DM, team blue, you have one minute to type /teamdm and join", pname);//
  1030. SendClientMessageToAll(0x33AA33AA,string);
  1031. return 1;
  1032. } else if(tdmon == 1 && tdmcolor == 1) {
  1033. playerintdm[playerid] = 1;
  1034. playerinminigame[playerid] = 1;
  1035. tdmrank++;
  1036. TogglePlayerControllable(playerid, 0);
  1037. SetPlayerInterior(playerid,0);
  1038. SetPlayerVirtualWorld(playerid,7);
  1039. SetPlayerPos(playerid,268.6240,1882.8805,-30.0938);
  1040. ResetPlayerWeapons(playerid);
  1041. GivePlayerWeapon(playerid,26,50000);
  1042. GivePlayerWeapon(playerid,31,50000);
  1043. GivePlayerWeapon(playerid,32,50000);
  1044. SetPlayerHealth(playerid,100);
  1045. SetPlayerArmour(playerid,100);
  1046. oldplayercolor[playerid] = GetPlayerColor(playerid);
  1047. SetPlayerColor(playerid,0xAA3333AA);// RED
  1048. redplayers++;
  1049. tdmcolor = 0;
  1050. format(string, sizeof(string), "%s has joined the team DM, team red", pname);//
  1051. SendClientMessageToAll(0x33AA33AA,string);
  1052. return 1;
  1053. } else if(tdmon == 1 && tdmcolor == 0) {
  1054. playerintdm[playerid] = 1;
  1055. playerinminigame[playerid] = 1;
  1056. tdmrank++;
  1057. TogglePlayerControllable(playerid, 0);
  1058. SetPlayerInterior(playerid,0);
  1059. SetPlayerVirtualWorld(playerid,7);
  1060. SetPlayerPos(playerid,208.8376,1863.5388,13.1406);
  1061. ResetPlayerWeapons(playerid);
  1062. GivePlayerWeapon(playerid,26,50000);
  1063. GivePlayerWeapon(playerid,31,50000);
  1064. GivePlayerWeapon(playerid,32,50000);
  1065. SetPlayerHealth(playerid,100);
  1066. SetPlayerArmour(playerid,100);
  1067. oldplayercolor[playerid] = GetPlayerColor(playerid);
  1068. SetPlayerColor(playerid,0x0000BBAA);// BLUE
  1069. blueplayers++;
  1070. tdmcolor = 1;
  1071. format(string, sizeof(string), "%s has joined the team DM, team blue", pname);//
  1072. SendClientMessageToAll(0x33AA33AA,string);
  1073. return 1;
  1074. }
  1075. }
  1076. if(strcmp(cmd, "/lvdm", true) == 0)
  1077. {
  1078. if(dmplaying == 1)
  1079. {
  1080. SendClientMessage(playerid, 0xB4B5B7AA, "The LVDM is already started");
  1081. return 1;
  1082. }
  1083. if(playerinminigame[playerid] == 1)
  1084. {
  1085. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1086. return 1;
  1087. }
  1088. new pname[256];
  1089. GetPlayerName(playerid, pname, 256);
  1090. if(dmon == 0)
  1091. {
  1092. dmon = 1;
  1093. playerindm[playerid] = 1;
  1094. playerinminigame[playerid] = 1;
  1095. dmrank = 1;
  1096. TogglePlayerControllable(playerid, 0);
  1097. SetPlayerInterior(playerid,0);
  1098. SetPlayerVirtualWorld(playerid,7);
  1099. SetPlayerPos(playerid,lvdmspawns[0][0],lvdmspawns[0][1],lvdmspawns[0][2]);
  1100. ResetPlayerWeapons(playerid);
  1101. GivePlayerWeapon(playerid,26,50000);
  1102. GivePlayerWeapon(playerid,32,50000);
  1103. GivePlayerWeapon(playerid,31,50000);
  1104. SetPlayerHealth(playerid,100);
  1105. SetPlayerArmour(playerid,100);
  1106. startvar[2] = 1;
  1107. dmtimer = SetTimer("Startdm", 60000, 0);
  1108. format(string, sizeof(string), "%s has started a LVDM, you have one minute to type /lvdm and join", pname);//
  1109. SendClientMessageToAll(0x33AA33AA,string);
  1110. return 1;
  1111. } else if(dmon == 1 && dmrank <= 15) {
  1112. playerindm[playerid] = 1;
  1113. TogglePlayerControllable(playerid, 0);
  1114. SetPlayerInterior(playerid,0);
  1115. SetPlayerVirtualWorld(playerid,7);
  1116. SetPlayerPos(playerid,lvdmspawns[dmrank][0],lvdmspawns[dmrank][1],lvdmspawns[dmrank][2]);
  1117. dmrank++;
  1118. ResetPlayerWeapons(playerid);
  1119. GivePlayerWeapon(playerid,26,50000);
  1120. GivePlayerWeapon(playerid,32,50000);
  1121. GivePlayerWeapon(playerid,31,50000);
  1122. SetPlayerHealth(playerid,100);
  1123. SetPlayerArmour(playerid,100);
  1124. format(string, sizeof(string), "%s has joined the LVDM", pname);//
  1125. SendClientMessageToAll(0x33AA33AA,string);
  1126. return 1;
  1127. } else if(dmon == 1 && dmrank == 16) {
  1128. format(string, sizeof(string), "The LVDM is full, wait for the next LVDM");//
  1129. SendClientMessage(playerid,0x33AA33AA,string);
  1130. }
  1131. }
  1132.  
  1133. if(strcmp(cmd, "/qderby", true) == 0)
  1134. {
  1135. if(qderbyplaying == 1)
  1136. {
  1137. SendClientMessage(playerid, 0xB4B5B7AA, "The derby is already started");
  1138. return 1;
  1139. }
  1140. if(playerinminigame[playerid] == 1)
  1141. {
  1142. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1143. return 1;
  1144. }
  1145. new pname[256];
  1146. GetPlayerName(playerid, pname, 256);
  1147. if(qderbyon == 0)
  1148. {
  1149. Respawnqbloodrings();
  1150. qderbyon = 1;
  1151. playerinminigame[playerid] = 1;
  1152. playerinqderby[playerid] = 1;
  1153. qderbyrank = 1;
  1154. SetPlayerInterior(playerid,0);
  1155. SetPlayerVirtualWorld(playerid,7);
  1156. SetVehicleVirtualWorld(qbloodring[0],7);
  1157. qbloodringfull[0] = 1;
  1158. PutPlayerInVehicle(playerid, qbloodring[0], 0);
  1159. playerinqbloodring[playerid] = 0;
  1160. TogglePlayerControllable(playerid, 0);
  1161. startvar[3] = 1;
  1162. qdtimer = SetTimer("StartqDerby", 60000, 0);
  1163. format(string, sizeof(string), "%s has started a quarry derby, you have one minute to type /qderby and join", pname);//
  1164. SendClientMessageToAll(0x33AA33AA,string);
  1165. return 1;
  1166. } else if(qderbyon == 1 && qderbyrank < 15) {
  1167. playerinminigame[playerid] = 1;
  1168. playerinqderby[playerid] = 1;
  1169. qderbyrank++;
  1170. SetPlayerInterior(playerid,0);
  1171. for(new i=0; i<15; i++)
  1172. {
  1173. if(qbloodringfull[i] == 0)
  1174. {
  1175. SetPlayerVirtualWorld(playerid,7);
  1176. SetVehicleVirtualWorld(qbloodring[i],7);
  1177. qbloodringfull[i] = 1;
  1178. PutPlayerInVehicle(playerid, qbloodring[i], 0);
  1179. TogglePlayerControllable(playerid, 0);
  1180. playerinqbloodring[playerid] = i;
  1181. format(string, sizeof(string), "%s has joined the quarry derby", pname);//
  1182. SendClientMessageToAll(0x33AA33AA,string);
  1183. return 1;
  1184. }
  1185. }
  1186. } else if(qderbyon == 1 && qderbyrank >= 15) {
  1187. format(string, sizeof(string), "The quarry derby is full, wait for the next round", pname);//
  1188. SendClientMessage(playerid,0x33AA33AA,string);
  1189. return 1;
  1190. }
  1191. }
  1192.  
  1193. if(strcmp(cmd, "/boxing", true) == 0)
  1194. {
  1195. if(boxplaying == 1)
  1196. {
  1197. SendClientMessage(playerid, 0xB4B5B7AA, "The boxing fight is already started");
  1198. return 1;
  1199. }
  1200. if(playerinminigame[playerid] == 1)
  1201. {
  1202. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1203. return 1;
  1204. }
  1205. new pname[256];
  1206. GetPlayerName(playerid, pname, 256);
  1207. if(boxon == 0)
  1208. {
  1209. boxon = 1;
  1210. playerinbox[playerid] = 1;
  1211. playerinminigame[playerid] = 1;
  1212. boxrank = 1;
  1213. TogglePlayerControllable(playerid, 0);
  1214. SetPlayerInterior(playerid,0);
  1215. SetPlayerVirtualWorld(playerid,7);
  1216. SetPlayerPos(playerid,2496.479,-1678.357,6997.348);
  1217. ResetPlayerWeapons(playerid);
  1218. SetPlayerHealth(playerid,50);
  1219. startvar[4] = 1;
  1220. boxtimer = SetTimer("StartBox", 60000, 0);
  1221. format(string, sizeof(string), "%s has started a boxing fight, you have one minute to type /boxing and join", pname);//
  1222. SendClientMessageToAll(0x33AA33AA,string);
  1223. return 1;
  1224. } else if(boxon == 1) {
  1225. playerinbox[playerid] = 1;
  1226. TogglePlayerControllable(playerid, 0);
  1227. SetPlayerInterior(playerid,0);
  1228. SetPlayerVirtualWorld(playerid,7);
  1229. SetPlayerPos(playerid,2496.479,-1678.357,6997.348);
  1230. boxrank++;
  1231. ResetPlayerWeapons(playerid);
  1232. SetPlayerHealth(playerid,50);
  1233. format(string, sizeof(string), "%s has joined the boxing fight", pname);//
  1234. SendClientMessageToAll(0x33AA33AA,string);
  1235. return 1;
  1236. }
  1237. }
  1238. if(strcmp(cmd, "/sdive", true) == 0)
  1239. {
  1240. if(sdplaying == 1)
  1241. {
  1242. SendClientMessage(playerid, 0xB4B5B7AA, "The skydive is already started");
  1243. return 1;
  1244. }
  1245. if(playerinminigame[playerid] == 1)
  1246. {
  1247. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1248. return 1;
  1249. }
  1250. new pname[256];
  1251. GetPlayerName(playerid, pname, 256);
  1252. if(sdon == 0)
  1253. {
  1254. sdon = 1;
  1255. playerinsd[playerid] = 1;
  1256. playerinminigame[playerid] = 1;
  1257. sdrank = 1;
  1258. sdfirst = 1;
  1259. TogglePlayerControllable(playerid, 0);
  1260. SetPlayerInterior(playerid,0);
  1261. SetPlayerVirtualWorld(playerid,7);
  1262. SetPlayerPos(playerid,-1753.7169,884.6819,1000.000);
  1263. GivePlayerWeapon(playerid,46,1);
  1264. startvar[5] = 1;
  1265. sdtimer = SetTimer("StartSd", 60000, 0);
  1266. SetPlayerRaceCheckpoint(playerid,0,-1753.7169,884.6819,295.8750,-1753.7169,884.6819,290.8750,1);
  1267. format(string, sizeof(string), "%s has started a skydive, you have one minute to type /sdive and join", pname);//
  1268. SendClientMessageToAll(0x33AA33AA,string);
  1269. return 1;
  1270. } else if(sdon == 1) {
  1271. playerinsd[playerid] = 1;
  1272. TogglePlayerControllable(playerid, 0);
  1273. SetPlayerInterior(playerid,0);
  1274. SetPlayerVirtualWorld(playerid,7);
  1275. SetPlayerPos(playerid,-1753.7169,884.6819,1000.000);
  1276. sdrank++;
  1277. GivePlayerWeapon(playerid,46,1);
  1278. SetPlayerRaceCheckpoint(playerid,0,-1753.7169,884.6819,295.8750,-1753.7169,884.6819,290.8750,1);
  1279. format(string, sizeof(string), "%s has joined the skydive", pname);//
  1280. SendClientMessageToAll(0x33AA33AA,string);
  1281. return 1;
  1282. }
  1283. }
  1284.  
  1285. if(strcmp(cmd, "/kartrace", true) == 0)
  1286. {
  1287. if(kartplaying == 1)
  1288. {
  1289. SendClientMessage(playerid, 0xB4B5B7AA, "The kart race is already started");
  1290. return 1;
  1291. }
  1292. if(playerinminigame[playerid] == 1)
  1293. {
  1294. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1295. return 1;
  1296. }
  1297. new pname[256];
  1298. GetPlayerName(playerid, pname, 256);
  1299. if(karton == 0)
  1300. {
  1301. karton = 1;
  1302. playerinminigame[playerid] = 1;
  1303. playerinkartrace[playerid] = 1;
  1304. kartrank = 1;
  1305. krtfirst = 1;
  1306. currentcheckpoint[playerid] = 0;
  1307. SetPlayerInterior(playerid,15);
  1308. SetPlayerVirtualWorld(playerid,7);
  1309. SetVehicleVirtualWorld(karts[0],7);
  1310. kartfull[0] = 1;
  1311. PutPlayerInVehicle(playerid, karts[0], 0);
  1312. playerinkart[playerid] = 0;
  1313. TogglePlayerControllable(playerid, 0);
  1314. SetPlayerRaceCheckpoint(playerid,0,kcps[0][0],kcps[0][1],kcps[0][2],kcps[1][0],kcps[1][1],kcps[1][2],20);
  1315. startvar[6] = 1;
  1316. krttimer = SetTimer("StartKart", 60000, 0);
  1317. format(string, sizeof(string), "%s has started a kart race, you have one minute to type /kartrace and join", pname);//
  1318. SendClientMessageToAll(0x33AA33AA,string);
  1319. return 1;
  1320. } else if(karton == 1 && kartrank < 15) {
  1321. playerinminigame[playerid] = 1;
  1322. playerinkartrace[playerid] = 1;
  1323. kartrank++;
  1324. currentcheckpoint[playerid] = 0;
  1325. SetPlayerInterior(playerid,15);
  1326. for(new i=0; i<15; i++)
  1327. {
  1328. if(kartfull[i] == 0)
  1329. {
  1330. SetPlayerVirtualWorld(playerid,7);
  1331. SetVehicleVirtualWorld(karts[i],7);
  1332. kartfull[i] = 1;
  1333. PutPlayerInVehicle(playerid, karts[i], 0);
  1334. TogglePlayerControllable(playerid, 0);
  1335. SetPlayerRaceCheckpoint(playerid,0,kcps[0][0],kcps[0][1],kcps[0][2],kcps[1][0],kcps[1][1],kcps[1][2],20);
  1336. playerinkart[playerid] = i;
  1337. format(string, sizeof(string), "%s has joined the kart race", pname);//
  1338. SendClientMessageToAll(0x33AA33AA,string);
  1339. return 1;
  1340. }
  1341. }
  1342. } else if(karton == 1 && kartrank >= 15) {
  1343. format(string, sizeof(string), "The kart race is full, wait for the next round", pname);//
  1344. SendClientMessage(playerid,0x33AA33AA,string);
  1345. return 1;
  1346. }
  1347. }
  1348.  
  1349. if(strcmp(cmd, "/srace", true) == 0)
  1350. {
  1351. if(srplaying == 1)
  1352. {
  1353. SendClientMessage(playerid, 0xB4B5B7AA, "The stadium race is already started");
  1354. return 1;
  1355. }
  1356. if(playerinminigame[playerid] == 1)
  1357. {
  1358. SendClientMessage(playerid, 0xB4B5B7AA, "You are already in a minigame");
  1359. return 1;
  1360. }
  1361. new pname[256];
  1362. GetPlayerName(playerid, pname, 256);
  1363. if(sron == 0)
  1364. {
  1365. sron = 1;
  1366. playerinminigame[playerid] = 1;
  1367. playerinsr[playerid] = 1;
  1368. srrank = 1;
  1369. srfirst = 1;
  1370. currentracecheckpoint[playerid] = 0;
  1371. SetPlayerInterior(playerid,4);
  1372. SetPlayerVirtualWorld(playerid,7);
  1373. SetVehicleVirtualWorld(nrg[0],7);
  1374. nrgfull[0] = 1;
  1375. PutPlayerInVehicle(playerid, nrg[0], 0);
  1376. playerinnrg[playerid] = 0;
  1377. TogglePlayerControllable(playerid, 0);
  1378. SetPlayerRaceCheckpoint(playerid,0,srcps[0][0],srcps[0][1],srcps[0][2],srcps[1][0],srcps[1][1],srcps[1][2],10);
  1379. startvar[7] = 1;
  1380. srtimer = SetTimer("StartSr", 60000, 0);
  1381. format(string, sizeof(string), "%s has started a stadium race, you have one minute to type /srace and join", pname);//
  1382. SendClientMessageToAll(0x33AA33AA,string);
  1383. return 1;
  1384. } else if(sron == 1 && srrank < 15) {
  1385. playerinminigame[playerid] = 1;
  1386. playerinsr[playerid] = 1;
  1387. srrank++;
  1388. currentracecheckpoint[playerid] = 0;
  1389. SetPlayerInterior(playerid,4);
  1390. for(new i=0; i<15; i++)
  1391. {
  1392. if(nrgfull[i] == 0)
  1393. {
  1394. SetPlayerVirtualWorld(playerid,7);
  1395. SetVehicleVirtualWorld(nrg[i],7);
  1396. nrgfull[i] = 1;
  1397. PutPlayerInVehicle(playerid, nrg[i], 0);
  1398. TogglePlayerControllable(playerid, 0);
  1399. SetPlayerRaceCheckpoint(playerid,0,srcps[0][0],srcps[0][1],srcps[0][2],srcps[1][0],srcps[1][1],srcps[1][2],10);
  1400. playerinnrg[playerid] = i;
  1401. format(string, sizeof(string), "%s has joined the stadium race", pname);//
  1402. SendClientMessageToAll(0x33AA33AA,string);
  1403. return 1;
  1404. }
  1405. }
  1406. } else if(sron == 1 && srrank >= 15) {
  1407. format(string, sizeof(string), "The stadium race is full, wait for the next round", pname);//
  1408. SendClientMessage(playerid,0x33AA33AA,string);
  1409. return 1;
  1410. }
  1411. }
  1412.  
  1413. return 0;
  1414. }
  1415.  
  1416. public OnPlayerInfoChange(playerid)
  1417. {
  1418. return 1;
  1419. }
  1420.  
  1421. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  1422. {
  1423. return 1;
  1424. }
  1425.  
  1426. public OnPlayerExitVehicle(playerid, vehicleid)
  1427. {
  1428. return 1;
  1429. }
  1430.  
  1431. public OnPlayerStateChange(playerid, newstate, oldstate)
  1432. {
  1433. if(newstate == 2)
  1434. {
  1435. playercarid[playerid] = GetPlayerVehicleID(playerid);
  1436. }
  1437. if(oldstate == 2)
  1438. {
  1439. if(playerinderby[playerid] || playerinqderby[playerid] || playerinkartrace[playerid] || playerinsr[playerid])
  1440. {
  1441. PutPlayerInVehicle(playerid,playercarid[playerid],0);
  1442. }
  1443. }
  1444. return 1;
  1445. }
  1446.  
  1447. public OnPlayerEnterCheckpoint(playerid)
  1448. {
  1449. return 1;
  1450. }
  1451.  
  1452. public OnPlayerLeaveCheckpoint(playerid)
  1453. {
  1454. return 1;
  1455. }
  1456.  
  1457. public OnPlayerEnterRaceCheckpoint(playerid)
  1458. {
  1459. if(playerinsd[playerid])
  1460. {
  1461. SetTimerEx("SdFinish",2000,0,"i",playerid);
  1462. } else if(playerinkartrace[playerid]) {
  1463. if(currentcheckpoint[playerid] <= 2)
  1464. {
  1465. currentcheckpoint[playerid]++;
  1466. DisablePlayerRaceCheckpoint(playerid);
  1467. SetPlayerRaceCheckpoint(playerid,0,kcps[currentcheckpoint[playerid]][0],kcps[currentcheckpoint[playerid]][1],kcps[currentcheckpoint[playerid]][2],
  1468. kcps[currentcheckpoint[playerid]+1][0],kcps[currentcheckpoint[playerid]+1][1],kcps[currentcheckpoint[playerid]+1][2],20);
  1469. } else if(currentcheckpoint[playerid] >= 3 && currentcheckpoint[playerid] != 7) {
  1470. currentcheckpoint[playerid]++;
  1471. DisablePlayerRaceCheckpoint(playerid);
  1472. SetPlayerRaceCheckpoint(playerid,0,kcps[currentcheckpoint[playerid]-4][0],kcps[currentcheckpoint[playerid]-4][1],
  1473. kcps[currentcheckpoint[playerid]-4][2],kcps[currentcheckpoint[playerid]-3][0],kcps[currentcheckpoint[playerid]-3][1],
  1474. kcps[currentcheckpoint[playerid]-3][2],20);
  1475. } else if(currentcheckpoint[playerid] == 7) {
  1476. if(krtfirst == 1)
  1477. {
  1478. DisablePlayerRaceCheckpoint(playerid);
  1479. new string[256];
  1480. krtfirst++;
  1481. kartrank--;
  1482. new winnername[256];
  1483. GetPlayerName(playerid,winnername, sizeof(winnername));
  1484. RewardCalc(playerid,5000,10000);
  1485. format(string, sizeof(string), "%s has won the kart race for $%d", winnername, reward);
  1486. SendClientMessageToAll(0x33AA33AA, string);
  1487. GivePlayerMoney(playerid,reward);
  1488. playerinkartrace[playerid] = 0;
  1489. playerinminigame[playerid] = 0;
  1490. currentcheckpoint[playerid] = 0;
  1491. SetPlayerVirtualWorld(playerid,0);
  1492. SetPlayerInterior(playerid, 0);
  1493. SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
  1494. if(kartrank == 0)
  1495. {
  1496. KrtFinish();
  1497. } else {
  1498. SetTimer("KrtFinish",60000,0);
  1499. }
  1500. } else {
  1501. DisablePlayerRaceCheckpoint(playerid);
  1502. playerinkartrace[playerid] = 0;
  1503. playerinminigame[playerid] = 0;
  1504. currentcheckpoint[playerid] = 0;
  1505. SetPlayerVirtualWorld(playerid,0);
  1506. SetPlayerInterior(playerid, 0);
  1507. SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
  1508. if(kartrank == 0)
  1509. {
  1510. KrtFinish();
  1511. } else {
  1512. SetTimer("KrtFinish",60000,0);
  1513. }
  1514. }
  1515. }
  1516. } else if(playerinsr[playerid]) {
  1517. if(currentracecheckpoint[playerid] <= 7)
  1518. {
  1519. currentracecheckpoint[playerid]++;
  1520. DisablePlayerRaceCheckpoint(playerid);
  1521. SetPlayerRaceCheckpoint(playerid,0,srcps[currentracecheckpoint[playerid]][0],srcps[currentracecheckpoint[playerid]][1],
  1522. srcps[currentracecheckpoint[playerid]][2],srcps[currentracecheckpoint[playerid]+1][0],srcps[currentracecheckpoint[playerid]+1][1],
  1523. srcps[currentracecheckpoint[playerid]+1][2],10);
  1524. } else if(currentracecheckpoint[playerid] == 8) {
  1525. if(srfirst == 1)
  1526. {
  1527. DisablePlayerRaceCheckpoint(playerid);
  1528. new string[256];
  1529. srfirst++;
  1530. srrank--;
  1531. new winnername[256];
  1532. GetPlayerName(playerid,winnername, sizeof(winnername));
  1533. RewardCalc(playerid,5000,10000);
  1534. format(string, sizeof(string), "%s has won the stadium race for $%d", winnername, reward);
  1535. SendClientMessageToAll(0x33AA33AA, string);
  1536. GivePlayerMoney(playerid,reward);
  1537. playerinsr[playerid] = 0;
  1538. playerinminigame[playerid] = 0;
  1539. currentracecheckpoint[playerid] = 0;
  1540. SetPlayerVirtualWorld(playerid,0);
  1541. SetPlayerInterior(playerid, 0);
  1542. SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
  1543. if(srrank == 0)
  1544. {
  1545. SrFinish();
  1546. } else {
  1547. SetTimer("SrFinish",60000,0);
  1548. }
  1549. } else {
  1550. DisablePlayerRaceCheckpoint(playerid);
  1551. playerinsr[playerid] = 0;
  1552. playerinminigame[playerid] = 0;
  1553. currentracecheckpoint[playerid] = 0;
  1554. SetPlayerVirtualWorld(playerid,0);
  1555. SetPlayerInterior(playerid, 0);
  1556. SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
  1557. if(srrank == 0)
  1558. {
  1559. SrFinish();
  1560. } else {
  1561. SetTimer("SrFinish",60000,0);
  1562. }
  1563. }
  1564. }
  1565. }
  1566. return 1;
  1567. }
  1568.  
  1569. public OnPlayerLeaveRaceCheckpoint(playerid)
  1570. {
  1571. return 1;
  1572. }
  1573.  
  1574. public OnRconCommand(cmd[])
  1575. {
  1576. return 1;
  1577. }
  1578.  
  1579. public OnObjectMoved(objectid)
  1580. {
  1581. return 1;
  1582. }
  1583.  
  1584. public OnPlayerObjectMoved(playerid, objectid)
  1585. {
  1586. return 1;
  1587. }
  1588.  
  1589. public OnPlayerPickUpPickup(playerid, pickupid)
  1590. {
  1591. return 1;
  1592. }
  1593.  
  1594. public OnPlayerSelectedMenuRow(playerid, row)
  1595. {
  1596. return 1;
  1597. }
  1598.  
  1599. public OnPlayerExitedMenu(playerid)
  1600. {
  1601. return 1;
  1602. }
  1603.  
  1604. public Spawnbloodrings()
  1605. {
  1606. for(new i=0; i<15; i++)
  1607. {
  1608. bloodring[i] = CreateVehicle(504,derbycars[i][0],derbycars[i][1],derbycars[i][2],derbycars[i][3],-1,-1,-1);
  1609. LinkVehicleToInterior(bloodring[i],15);
  1610. SetVehicleVirtualWorld(bloodring[i],1);
  1611. bloodringfull[i] = 0;
  1612. }
  1613. return 1;
  1614. }
  1615.  
  1616. public Destroybloodrings()
  1617. {
  1618. for(new i=0; i<15; i++)
  1619. {
  1620. DestroyVehicle(bloodring[i]);
  1621. bloodringfull[i] = 0;
  1622. }
  1623. }
  1624.  
  1625. public Respawnbloodrings()
  1626. {
  1627. for(new i=0; i<15; i++)
  1628. {
  1629. SetVehicleToRespawn(bloodring[i]);
  1630. SetVehicleVirtualWorld(bloodring[i],1);
  1631. bloodringfull[i] = 0;
  1632. }
  1633. }
  1634.  
  1635. public Spawnqbloodrings()
  1636. {
  1637. for(new i=0; i<15; i++)
  1638. {
  1639. qbloodring[i] = CreateVehicle(504,qderbycars[i][0],qderbycars[i][1],qderbycars[i][2],qderbycars[i][3],-1,-1,-1);
  1640. SetVehicleVirtualWorld(qbloodring[i],1);
  1641. qbloodringfull[i] = 0;
  1642. }
  1643. return 1;
  1644. }
  1645.  
  1646. public Destroyqbloodrings()
  1647. {
  1648. for(new i=0; i<15; i++)
  1649. {
  1650. DestroyVehicle(qbloodring[i]);
  1651. qbloodringfull[i] = 0;
  1652. }
  1653. }
  1654.  
  1655. public Respawnqbloodrings()
  1656. {
  1657. for(new i=0; i<15; i++)
  1658. {
  1659. SetVehicleToRespawn(qbloodring[i]);
  1660. SetVehicleVirtualWorld(qbloodring[i],1);
  1661. qbloodringfull[i] = 0;
  1662. }
  1663. }
  1664.  
  1665. public SpawnKarts()
  1666. {
  1667. for(new i=0; i<15; i++)
  1668. {
  1669. karts[i] = CreateVehicle(571,kartspawns[i][0],kartspawns[i][1],kartspawns[i][2],kartspawns[i][3],-1,-1,-1);
  1670. LinkVehicleToInterior(karts[i],15);
  1671. SetVehicleVirtualWorld(karts[i],1);
  1672. kartfull[i] = 0;
  1673. }
  1674. return 1;
  1675. }
  1676.  
  1677. public DestroyKarts()
  1678. {
  1679. for(new i=0; i<15; i++)
  1680. {
  1681. DestroyVehicle(karts[i]);
  1682. kartfull[i] = 0;
  1683. }
  1684. }
  1685.  
  1686. public RespawnKarts()
  1687. {
  1688. for(new i=0; i<15; i++)
  1689. {
  1690. SetVehicleToRespawn(karts[i]);
  1691. SetVehicleVirtualWorld(karts[i],1);
  1692. kartfull[i] = 0;
  1693. }
  1694. }
  1695.  
  1696. public SpawnNrgs()
  1697. {
  1698. for(new i=0; i<15; i++)
  1699. {
  1700. nrg[i] = CreateVehicle(522,nrgspawns[i][0],nrgspawns[i][1],nrgspawns[i][2],nrgspawns[i][3],-1,-1,-1);
  1701. LinkVehicleToInterior(nrg[i],4);
  1702. SetVehicleVirtualWorld(nrg[i],1);
  1703. nrgfull[i] = 0;
  1704. }
  1705. return 1;
  1706. }
  1707.  
  1708. public DestroyNrgs()
  1709. {
  1710. for(new i=0; i<15; i++)
  1711. {
  1712. DestroyVehicle(nrg[i]);
  1713. nrgfull[i] = 0;
  1714. }
  1715. }
  1716.  
  1717. public RespawnNrgs()
  1718. {
  1719. for(new i=0; i<15; i++)
  1720. {
  1721. SetVehicleToRespawn(nrg[i]);
  1722. SetVehicleVirtualWorld(nrg[i],1);
  1723. nrgfull[i] = 0;
  1724. }
  1725. }
  1726.  
  1727. strtok(const string[], &index)
  1728. {
  1729. new length = strlen(string);
  1730. while ((index < length) && (string[index] <= ' '))
  1731. {
  1732. index++;
  1733. }
  1734.  
  1735. new offset = index;
  1736. new result[20];
  1737. while ((index < length) && (string[index] > ' ') && ((index - offset) < (sizeof(result) - 1)))
  1738. {
  1739. result[index - offset] = string[index];
  1740. index++;
  1741. }
  1742. result[index - offset] = EOS;
  1743. return result;
  1744. }
  1745.  
  1746. public StartDerby()
  1747. {
  1748. new delay = 1000;
  1749. new string[32];
  1750. if(startvar[0] == 1)
  1751. {
  1752. if( derbyrank <= 1 )
  1753. {
  1754. SendClientMessageToAll(0x33AA33AA, "Derby canceled. Reason: Not enough players. (minimum = 2)");
  1755. derbyplaying = 0;
  1756. derbyrank = 0;
  1757. derbyon = 0;
  1758. startvar[0] = 0;
  1759. Respawnbloodrings();
  1760. for(new i = 0; i <= MAX_PLAYERS; i++)
  1761. {
  1762. if(IsPlayerConnected(i))
  1763. {
  1764. if (playerinderby[i] == 1)
  1765. {
  1766. playerinderby[i] = 0;
  1767. playerinminigame[i] = 0;
  1768. playerinbloodring[i] = -1;
  1769. SetPlayerVirtualWorld(i,0);
  1770. SetPlayerInterior(i, 0);
  1771. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  1772. TogglePlayerControllable(i, 1);
  1773. }
  1774. }
  1775. }
  1776. return 1;
  1777. }
  1778. format(string, sizeof(string), "~r~Ready");
  1779. derbyplaying = 1;
  1780. for(new i = 0; i <= MAX_PLAYERS; i++)
  1781. {
  1782. if(IsPlayerConnected(i))
  1783. {
  1784. if (playerinderby[i] == 1)
  1785. {
  1786. GameTextForPlayer(i, string, delay, 6);
  1787. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1788. }
  1789. }
  1790. }
  1791. startvar[0] = 2;
  1792. SetTimer("StartDerby", delay, 0);
  1793. } else if(startvar[0] == 2) {
  1794. format(string, sizeof(string), "~r~Set");
  1795. for(new i = 0; i <= MAX_PLAYERS; i++)
  1796. {
  1797. if(IsPlayerConnected(i))
  1798. {
  1799. if (playerinderby[i] == 1)
  1800. {
  1801. GameTextForPlayer(i, string, delay, 6);
  1802. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1803. }
  1804. }
  1805. }
  1806. startvar[0] = 3;
  1807. SetTimer("StartDerby", delay, 0);
  1808. } else if(startvar[0] == 3) {
  1809. format(string, sizeof(string), "~g~RAM!");
  1810. for(new i = 0; i <= MAX_PLAYERS; i++)
  1811. {
  1812. if(IsPlayerConnected(i))
  1813. {
  1814. if (playerinderby[i] == 1)
  1815. {
  1816. GameTextForPlayer(i, string, delay, 6);
  1817. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  1818. TogglePlayerControllable(i, 1);
  1819. }
  1820. }
  1821. }
  1822. startvar[0] = 0;
  1823. }
  1824. return 1;
  1825. }
  1826.  
  1827. public Starttdm()
  1828. {
  1829. new delay=1000;
  1830. new string[32];
  1831. if(startvar[1] == 1)
  1832. {
  1833. if( tdmrank <= 1 )
  1834. {
  1835. SendClientMessageToAll(0x33AA33AA, "Team DM canceled. Reason: Not enough players. (minimum = 2)");
  1836. tdmplaying = 0;
  1837. tdmrank = 0;
  1838. tdmon = 0;
  1839. startvar[1] = 0;
  1840. for(new i = 0; i <= MAX_PLAYERS; i++)
  1841. {
  1842. if(IsPlayerConnected(i))
  1843. {
  1844. if (playerintdm[i] == 1)
  1845. {
  1846. playerintdm[i] = 0;
  1847. playerinminigame[i] = 0;
  1848. SetPlayerVirtualWorld(i,0);
  1849. SetPlayerInterior(i, 0);
  1850. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  1851. TogglePlayerControllable(i, 1);
  1852. }
  1853. }
  1854. }
  1855. return 1;
  1856. }
  1857. format(string, sizeof(string), "~r~Ready");
  1858. tdmplaying = 1;
  1859. for(new i = 0; i <= MAX_PLAYERS; i++)
  1860. {
  1861. if(IsPlayerConnected(i))
  1862. {
  1863. if (playerintdm[i] == 1)
  1864. {
  1865. GameTextForPlayer(i, string, delay, 6);
  1866. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1867. }
  1868. }
  1869. }
  1870. startvar[1] = 2;
  1871. SetTimer("Starttdm", delay, 0);
  1872. } else if(startvar[1] == 2) {
  1873. format(string, sizeof(string), "~r~Set");
  1874. for(new i = 0; i <= MAX_PLAYERS; i++)
  1875. {
  1876. if(IsPlayerConnected(i))
  1877. {
  1878. if (playerintdm[i] == 1)
  1879. {
  1880. GameTextForPlayer(i, string, delay, 6);
  1881. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1882. }
  1883. }
  1884. }
  1885. startvar[1] = 3;
  1886. SetTimer("Starttdm", delay, 0);
  1887. } else if(startvar[1] == 3) {
  1888. format(string, sizeof(string), "~g~FIGHT!");
  1889. for(new i = 0; i <= MAX_PLAYERS; i++)
  1890. {
  1891. if(IsPlayerConnected(i))
  1892. {
  1893. if (playerintdm[i] == 1)
  1894. {
  1895. GameTextForPlayer(i, string, delay, 6);
  1896. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  1897. TogglePlayerControllable(i, 1);
  1898. }
  1899. }
  1900. }
  1901. startvar[1] = 0;
  1902. }
  1903. return 1;
  1904. }
  1905.  
  1906. public Startdm()
  1907. {
  1908. if(startvar[2] == 1)
  1909. {
  1910. if( dmrank <= 1 )
  1911. {
  1912. SendClientMessageToAll(0x33AA33AA, "LVDM canceled. Reason: Not enough players. (minimum = 2)");
  1913. dmplaying = 0;
  1914. dmrank = 0;
  1915. dmon = 0;
  1916. startvar[2] = 0;
  1917. for(new i = 0; i <= MAX_PLAYERS; i++)
  1918. {
  1919. if(IsPlayerConnected(i))
  1920. {
  1921. if (playerindm[i] == 1)
  1922. {
  1923. playerindm[i] = 0;
  1924. playerinminigame[i] = 0;
  1925. SetPlayerVirtualWorld(i,0);
  1926. SetPlayerInterior(i, 0);
  1927. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  1928. TogglePlayerControllable(i, 1);
  1929. }
  1930. }
  1931. }
  1932. return 1;
  1933. }
  1934. new string[32];
  1935. format(string, sizeof(string), "~r~Ready");
  1936. new gdelay=1000;
  1937. dmplaying = 1;
  1938. for(new i = 0; i <= MAX_PLAYERS; i++)
  1939. {
  1940. if(IsPlayerConnected(i))
  1941. {
  1942. if (playerindm[i] == 1)
  1943. {
  1944. GameTextForPlayer(i, string, gdelay, 6);
  1945. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1946. }
  1947. }
  1948. }
  1949. startvar[2] = 2;
  1950. SetTimer("Startdm", gdelay, 0);
  1951. } else if(startvar[2] == 2) {
  1952. new string[32];
  1953. format(string, sizeof(string), "~r~Set");
  1954. new hdelay=1000;
  1955. for(new i = 0; i <= MAX_PLAYERS; i++)
  1956. {
  1957. if(IsPlayerConnected(i))
  1958. {
  1959. if (playerindm[i] == 1)
  1960. {
  1961. GameTextForPlayer(i, string, hdelay, 6);
  1962. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  1963. }
  1964. }
  1965. }
  1966. startvar[2] = 3;
  1967. SetTimer("Startdm", hdelay, 0);
  1968. } else if(startvar[2] == 3) {
  1969. new rdelay=1000;
  1970. new string[32];
  1971. format(string, sizeof(string), "~g~FIGHT!");
  1972. for(new i = 0; i <= MAX_PLAYERS; i++)
  1973. {
  1974. if(IsPlayerConnected(i))
  1975. {
  1976. if (playerindm[i] == 1)
  1977. {
  1978. GameTextForPlayer(i, string, rdelay, 6);
  1979. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  1980. TogglePlayerControllable(i, 1);
  1981. }
  1982. }
  1983. }
  1984. startvar[2] = 0;
  1985. }
  1986. return 1;
  1987. }
  1988.  
  1989. public StartqDerby()
  1990. {
  1991. if(startvar[3] == 1)
  1992. {
  1993. if( qderbyrank <= 1 )
  1994. {
  1995. SendClientMessageToAll(0x33AA33AA, "Quarry derby canceled. Reason: Not enough players. (minimum = 2)");
  1996. qderbyplaying = 0;
  1997. qderbyrank = 0;
  1998. qderbyon = 0;
  1999. startvar[3] = 0;
  2000. Respawnqbloodrings();
  2001. for(new i = 0; i <= MAX_PLAYERS; i++)
  2002. {
  2003. if(IsPlayerConnected(i))
  2004. {
  2005. if (playerinqderby[i] == 1)
  2006. {
  2007. playerinqderby[i] = 0;
  2008. playerinminigame[i] = 0;
  2009. playerinqbloodring[i] = -1;
  2010. SetPlayerVirtualWorld(i,0);
  2011. SetPlayerInterior(i, 0);
  2012. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2013. TogglePlayerControllable(i, 1);
  2014. }
  2015. }
  2016. }
  2017. return 1;
  2018. }
  2019. new string[32];
  2020. format(string, sizeof(string), "~r~Ready");
  2021. new gdelay=1000;
  2022. qderbyplaying = 1;
  2023. for(new i = 0; i <= MAX_PLAYERS; i++)
  2024. {
  2025. if(IsPlayerConnected(i))
  2026. {
  2027. if (playerinqderby[i] == 1)
  2028. {
  2029. GameTextForPlayer(i, string, gdelay, 6);
  2030. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2031. }
  2032. }
  2033. }
  2034. startvar[3] = 2;
  2035. SetTimer("StartqDerby", gdelay, 0);
  2036. } else if(startvar[3] == 2) {
  2037. new string[32];
  2038. format(string, sizeof(string), "~r~Set");
  2039. new hdelay=1000;
  2040. for(new i = 0; i <= MAX_PLAYERS; i++)
  2041. {
  2042. if(IsPlayerConnected(i))
  2043. {
  2044. if (playerinqderby[i] == 1)
  2045. {
  2046. GameTextForPlayer(i, string, hdelay, 6);
  2047. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2048. }
  2049. }
  2050. }
  2051. startvar[3] = 3;
  2052. SetTimer("StartqDerby", hdelay, 0);
  2053. } else if(startvar[3] == 3) {
  2054. new rdelay=1000;
  2055. new string[32];
  2056. format(string, sizeof(string), "~g~RAM!");
  2057. for(new i = 0; i <= MAX_PLAYERS; i++)
  2058. {
  2059. if(IsPlayerConnected(i))
  2060. {
  2061. if (playerinqderby[i] == 1)
  2062. {
  2063. GameTextForPlayer(i, string, rdelay, 6);
  2064. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2065. TogglePlayerControllable(i, 1);
  2066. }
  2067. }
  2068. }
  2069. startvar[3] = 0;
  2070. }
  2071. return 1;
  2072. }
  2073.  
  2074. public StartBox()
  2075. {
  2076. if(startvar[4] == 1)
  2077. {
  2078. if( boxrank <= 1 )
  2079. {
  2080. SendClientMessageToAll(0x33AA33AA, "boxing fight canceled. Reason: Not enough players. (minimum = 2)");
  2081. boxplaying = 0;
  2082. boxrank = 0;
  2083. boxon = 0;
  2084. startvar[4] = 0;
  2085. for(new i = 0; i <= MAX_PLAYERS; i++)
  2086. {
  2087. if(IsPlayerConnected(i))
  2088. {
  2089. if (playerinbox[i] == 1)
  2090. {
  2091. playerinbox[i] = 0;
  2092. playerinminigame[i] = 0;
  2093. SetPlayerVirtualWorld(i,0);
  2094. SetPlayerInterior(i, 0);
  2095. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2096. TogglePlayerControllable(i, 1);
  2097. }
  2098. }
  2099. }
  2100. return 1;
  2101. }
  2102. new string[32];
  2103. format(string, sizeof(string), "~r~Ready");
  2104. new gdelay=1000;
  2105. boxplaying = 1;
  2106. for(new i = 0; i <= MAX_PLAYERS; i++)
  2107. {
  2108. if(IsPlayerConnected(i))
  2109. {
  2110. if (playerinbox[i] == 1)
  2111. {
  2112. GameTextForPlayer(i, string, gdelay, 6);
  2113. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2114. }
  2115. }
  2116. }
  2117. startvar[4] = 2;
  2118. SetTimer("StartBox", gdelay, 0);
  2119. } else if(startvar[4] == 2) {
  2120. new string[32];
  2121. format(string, sizeof(string), "~r~Set");
  2122. new hdelay=1000;
  2123. for(new i = 0; i <= MAX_PLAYERS; i++)
  2124. {
  2125. if(IsPlayerConnected(i))
  2126. {
  2127. if (playerinbox[i] == 1)
  2128. {
  2129. GameTextForPlayer(i, string, hdelay, 6);
  2130. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2131. }
  2132. }
  2133. }
  2134. startvar[4] = 3;
  2135. SetTimer("StartBox", hdelay, 0);
  2136. } else if(startvar[4] == 3) {
  2137. new rdelay=1000;
  2138. new string[32];
  2139. format(string, sizeof(string), "~g~FIGHT!");
  2140. for(new i = 0; i <= MAX_PLAYERS; i++)
  2141. {
  2142. if(IsPlayerConnected(i))
  2143. {
  2144. if (playerinbox[i] == 1)
  2145. {
  2146. GameTextForPlayer(i, string, rdelay, 6);
  2147. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2148. TogglePlayerControllable(i, 1);
  2149. }
  2150. }
  2151. }
  2152. startvar[4] = 0;
  2153. }
  2154. return 1;
  2155. }
  2156.  
  2157. public StartSd()
  2158. {
  2159. if(startvar[5] == 1)
  2160. {
  2161. if( sdrank <= 1 )
  2162. {
  2163. SendClientMessageToAll(0x33AA33AA, "Skydive canceled. Reason: Not enough players. (minimum = 2)");
  2164. sdplaying = 0;
  2165. sdrank = 0;
  2166. sdon = 0;
  2167. startvar[5] = 0;
  2168. for(new i = 0; i <= MAX_PLAYERS; i++)
  2169. {
  2170. if(IsPlayerConnected(i))
  2171. {
  2172. if (playerinsd[i] == 1)
  2173. {
  2174. playerinsd[i] = 0;
  2175. playerinminigame[i] = 0;
  2176. SetPlayerVirtualWorld(i,0);
  2177. SetPlayerInterior(i, 0);
  2178. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2179. TogglePlayerControllable(i, 1);
  2180. }
  2181. }
  2182. }
  2183. return 1;
  2184. }
  2185. new string[32];
  2186. format(string, sizeof(string), "~r~Ready");
  2187. new gdelay=1000;
  2188. sdplaying = 1;
  2189. for(new i = 0; i <= MAX_PLAYERS; i++)
  2190. {
  2191. if(IsPlayerConnected(i))
  2192. {
  2193. if (playerinsd[i] == 1)
  2194. {
  2195. GameTextForPlayer(i, string, gdelay, 6);
  2196. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2197. }
  2198. }
  2199. }
  2200. startvar[5] = 2;
  2201. SetTimer("StartSd", gdelay, 0);
  2202. } else if(startvar[5] == 2) {
  2203. new string[32];
  2204. format(string, sizeof(string), "~r~Set");
  2205. new hdelay=1000;
  2206. for(new i = 0; i <= MAX_PLAYERS; i++)
  2207. {
  2208. if(IsPlayerConnected(i))
  2209. {
  2210. if (playerinsd[i] == 1)
  2211. {
  2212. GameTextForPlayer(i, string, hdelay, 6);
  2213. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2214. }
  2215. }
  2216. }
  2217. startvar[5] = 3;
  2218. SetTimer("StartSd", hdelay, 0);
  2219. } else if(startvar[5] == 3) {
  2220. new rdelay=1000;
  2221. new string[32];
  2222. format(string, sizeof(string), "~g~GO!");
  2223. for(new i = 0; i <= MAX_PLAYERS; i++)
  2224. {
  2225. if(IsPlayerConnected(i))
  2226. {
  2227. if (playerinsd[i] == 1)
  2228. {
  2229. GameTextForPlayer(i, string, rdelay, 6);
  2230. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2231. TogglePlayerControllable(i, 1);
  2232. }
  2233. }
  2234. }
  2235. SetTimer("EndSd",180000,0);
  2236. startvar[5] = 0;
  2237. }
  2238. return 1;
  2239. }
  2240.  
  2241. public EndSd()
  2242. {
  2243. for(new i = 0; i <= MAX_PLAYERS; i++)
  2244. {
  2245. if(IsPlayerConnected(i))
  2246. {
  2247. if (playerinsd[i] == 1)
  2248. {
  2249. playerinsd[i] = 0;
  2250. playerinminigame[i] = 0;
  2251. SetPlayerVirtualWorld(i,0);
  2252. SetPlayerInterior(i, 0);
  2253. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2254. }
  2255. }
  2256. }
  2257. sdplaying = 0;
  2258. sdrank = 0;
  2259. sdon = 0;
  2260. startvar[5] = 0;
  2261. SendClientMessageToAll(0x33AA33AA, "The skydive has ended");
  2262. return 1;
  2263. }
  2264.  
  2265. public StartKart()
  2266. {
  2267. if(startvar[6] == 1) {
  2268. if( kartrank <= 1 )
  2269. {
  2270. SendClientMessageToAll(0x33AA33AA, "Kart race canceled. Reason: Not enough players. (minimum = 2)");
  2271. kartplaying = 0;
  2272. kartrank = 0;
  2273. karton = 0;
  2274. startvar[6] = 0;
  2275. RespawnKarts();
  2276. for(new i = 0; i <= MAX_PLAYERS; i++)
  2277. {
  2278. if(IsPlayerConnected(i))
  2279. {
  2280. if (playerinkartrace[i] == 1)
  2281. {
  2282. playerinkartrace[i] = 0;
  2283. playerinminigame[i] = 0;
  2284. playerinkart[i] = -1;
  2285. SetPlayerVirtualWorld(i,0);
  2286. SetPlayerInterior(i, 0);
  2287. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2288. TogglePlayerControllable(i, 1);
  2289. }
  2290. }
  2291. }
  2292. return 1;
  2293. }
  2294. new string[32];
  2295. format(string, sizeof(string), "~r~Ready");
  2296. new gdelay=1000;
  2297. kartplaying = 1;
  2298. for(new i = 0; i <= MAX_PLAYERS; i++)
  2299. {
  2300. if(IsPlayerConnected(i))
  2301. {
  2302. if (playerinkartrace[i] == 1)
  2303. {
  2304. GameTextForPlayer(i, string, gdelay, 6);
  2305. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2306. }
  2307. }
  2308. }
  2309. startvar[6] = 2;
  2310. SetTimer("StartKart", gdelay, 0);
  2311. } else if(startvar[6] == 2) {
  2312. new string[32];
  2313. format(string, sizeof(string), "~r~Set");
  2314. new hdelay=1000;
  2315. for(new i = 0; i <= MAX_PLAYERS; i++)
  2316. {
  2317. if(IsPlayerConnected(i))
  2318. {
  2319. if (playerinkartrace[i] == 1)
  2320. {
  2321. GameTextForPlayer(i, string, hdelay, 6);
  2322. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2323. }
  2324. }
  2325. }
  2326. startvar[6] = 3;
  2327. SetTimer("StartKart", hdelay, 0);
  2328. } else if(startvar[6] == 3) {
  2329. new rdelay=1000;
  2330. new string[32];
  2331. format(string, sizeof(string), "~g~GO!");
  2332. for(new i = 0; i <= MAX_PLAYERS; i++)
  2333. {
  2334. if(IsPlayerConnected(i))
  2335. {
  2336. if (playerinkartrace[i] == 1)
  2337. {
  2338. GameTextForPlayer(i, string, rdelay, 6);
  2339. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2340. TogglePlayerControllable(i, 1);
  2341. }
  2342. }
  2343. }
  2344. SetTimer("KrtFinish",300000,0);
  2345. startvar[6] = 0;
  2346. }
  2347. return 1;
  2348. }
  2349.  
  2350. public StartSr()
  2351. {
  2352. if(startvar[7] == 1)
  2353. {
  2354. if( srrank <= 1 )
  2355. {
  2356. SendClientMessageToAll(0x33AA33AA, "Stadium race canceled. Reason: Not enough players. (minimum = 2)");
  2357. srplaying = 0;
  2358. srrank = 0;
  2359. sron = 0;
  2360. startvar[7] = 0;
  2361. RespawnNrgs();
  2362. for(new i = 0; i <= MAX_PLAYERS; i++)
  2363. {
  2364. if(IsPlayerConnected(i))
  2365. {
  2366. if (playerinsr[i] == 1)
  2367. {
  2368. playerinsr[i] = 0;
  2369. playerinminigame[i] = 0;
  2370. playerinnrg[i] = -1;
  2371. SetPlayerVirtualWorld(i,0);
  2372. SetPlayerInterior(i, 0);
  2373. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2374. TogglePlayerControllable(i, 1);
  2375. }
  2376. }
  2377. }
  2378. return 1;
  2379. }
  2380. new string[32];
  2381. format(string, sizeof(string), "~r~Ready");
  2382. new gdelay=1000;
  2383. kartplaying = 1;
  2384. for(new i = 0; i <= MAX_PLAYERS; i++)
  2385. {
  2386. if(IsPlayerConnected(i))
  2387. {
  2388. if (playerinsr[i] == 1)
  2389. {
  2390. GameTextForPlayer(i, string, gdelay, 6);
  2391. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2392. }
  2393. }
  2394. }
  2395. startvar[7] = 2;
  2396. SetTimer("StartSr", gdelay, 0);
  2397. } else if(startvar[7] == 2) {
  2398. new string[32];
  2399. format(string, sizeof(string), "~r~Set");
  2400. new hdelay=1000;
  2401. for(new i = 0; i <= MAX_PLAYERS; i++)
  2402. {
  2403. if(IsPlayerConnected(i))
  2404. {
  2405. if (playerinsr[i] == 1)
  2406. {
  2407. GameTextForPlayer(i, string, hdelay, 6);
  2408. PlayerPlaySound(i, 1056, 0.0, 0.0, 0.0);
  2409. }
  2410. }
  2411. }
  2412. startvar[7] = 3;
  2413. SetTimer("StartSr", hdelay, 0);
  2414. } else if(startvar[7] == 3) {
  2415. new rdelay=1000;
  2416. new string[32];
  2417. format(string, sizeof(string), "~g~GO!");
  2418. for(new i = 0; i <= MAX_PLAYERS; i++)
  2419. {
  2420. if(IsPlayerConnected(i))
  2421. {
  2422. if (playerinsr[i] == 1)
  2423. {
  2424. GameTextForPlayer(i, string, rdelay, 6);
  2425. PlayerPlaySound(i, 1057, 0.0, 0.0, 0.0);
  2426. TogglePlayerControllable(i, 1);
  2427. }
  2428. }
  2429. }
  2430. SetTimer("SrFinish",300000,0);
  2431. startvar[7] = 0;
  2432. }
  2433. return 1;
  2434. }
  2435.  
  2436. public RewardCalc(playerid,min,max)//Originally from PenLS
  2437. {
  2438. reward = (min + (random(max-min)));
  2439. }
  2440.  
  2441. public PlayerToPoint(Float:radi, playerid, Float:x, Float:y, Float:z)
  2442. {
  2443. if(IsPlayerConnected(playerid))
  2444. {
  2445. new Float:oldposx, Float:oldposy, Float:oldposz;
  2446. new Float:tempposx, Float:tempposy, Float:tempposz;
  2447. GetPlayerPos(playerid, oldposx, oldposy, oldposz);
  2448. tempposx = (oldposx -x);
  2449. tempposy = (oldposy -y);
  2450. tempposz = (oldposz -z);
  2451. if (((tempposx < radi) && (tempposx > -radi)) && ((tempposy < radi) && (tempposy > -radi)) && ((tempposz < radi) && (tempposz > -radi)))
  2452. {
  2453. return 1;
  2454. }
  2455. }
  2456. return 0;
  2457. }
  2458.  
  2459. public SdFinish(playerid)
  2460. {
  2461. if(playerinsd[playerid] == 1 && PlayerToPoint(5,playerid,-1753.7169,884.6819,295.8750))
  2462. {
  2463. if(sdfirst == 1)
  2464. {
  2465. DisablePlayerRaceCheckpoint(playerid);
  2466. new string[256];
  2467. sdfirst = 0;
  2468. new winnername[256];
  2469. GetPlayerName(playerid,winnername, sizeof(winnername));
  2470. RewardCalc(playerid,5000,10000);
  2471. format(string, sizeof(string), "%s has won the skydive for $%d", winnername, reward);
  2472. SendClientMessageToAll(0x33AA33AA, string);
  2473. GivePlayerMoney(playerid,reward);
  2474. playerinsd[playerid] = 0;
  2475. playerinminigame[playerid] = 0;
  2476. SetPlayerVirtualWorld(playerid,0);
  2477. SetPlayerInterior(playerid, 0);
  2478. SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
  2479. SetTimer("EndSd",60000,0);
  2480. } else {
  2481. DisablePlayerRaceCheckpoint(playerid);
  2482. playerinsd[playerid] = 0;
  2483. playerinminigame[playerid] = 0;
  2484. SetPlayerVirtualWorld(playerid,0);
  2485. SetPlayerInterior(playerid, 0);
  2486. SetPlayerPos(playerid, spawnX, spawnY, spawnZ);
  2487. }
  2488. }
  2489. }
  2490.  
  2491. public load()
  2492. {
  2493. Spawnbloodrings();
  2494. Spawnqbloodrings();
  2495. SpawnKarts();
  2496. SpawnNrgs();
  2497.  
  2498. CreateObject(975, 213.7231, 1875.3864, 13.8800, 0.0000, 0.0000, 180);// area 51 gate for TeamDM
  2499.  
  2500. // LVDM zone:
  2501. CreateObject(975,2237.232,2453.272,11.353,0.0,0.0,90.000);//Gates
  2502. CreateObject(975,2293.831,2499.356,4.016,0.0,0.0,90.000);
  2503. CreateObject(975,2335.095,2443.816,6.436,0.0,0.0,56.250);
  2504. CreateObject(1225,2242.148,2481.337,2.679,0.0,0.0,0.0);//Explosive barrels
  2505. CreateObject(1225,2249.003,2476.099,2.679,0.0,0.0,0.0);
  2506. CreateObject(1225,2269.786,2485.744,2.679,0.0,0.0,0.0);
  2507. CreateObject(1225,2309.837,2472.542,2.679,0.0,0.0,0.0);
  2508. CreateObject(1225,2296.421,2456.946,2.679,0.0,0.0,0.0);
  2509. CreateObject(1225,2276.625,2436.773,2.679,0.0,0.0,0.0);
  2510. CreateObject(1225,2251.733,2443.828,2.679,0.0,0.0,0.0);
  2511. CreateObject(1225,2335.119,2447.098,5.029,0.0,0.0,0.0);
  2512. CreateObject(1225,2334.300,2446.371,4.971,0.0,0.0,0.0);
  2513. CreateObject(1225,2332.263,2444.455,4.774,0.0,0.0,0.0);
  2514. CreateObject(1225,2333.340,2443.961,5.007,0.0,0.0,0.0);
  2515. CreateObject(1225,2332.409,2441.871,5.056,0.0,0.0,0.0);
  2516. CreateObject(1225,2329.335,2443.138,4.298,0.0,0.0,0.0);
  2517. CreateObject(1225,2328.618,2445.822,4.055,0.0,0.0,0.0);
  2518. CreateObject(1225,2330.095,2446.103,4.320,0.0,0.0,0.0);
  2519. CreateObject(1225,2329.184,2444.807,4.575,0.0,0.0,0.0);
  2520. CreateObject(1556,2294.025,2494.454,3.789,0.0,0.0,-90.000);//Door
  2521.  
  2522. CreateObject(16681,2494.841,-1676.981,7000.000,0.0,0.0,0.0);//Boxing Arena
  2523.  
  2524. SendClientMessageToAll(0xFFFF00AA,"Minigames filterscript loaded. Type /minigames for more information.");
  2525. }
  2526.  
  2527. public KrtFinish()
  2528. {
  2529. for(new i = 0; i <= MAX_PLAYERS; i++)
  2530. {
  2531. if(IsPlayerConnected(i))
  2532. {
  2533. if (playerinkartrace[i] == 1)
  2534. {
  2535. playerinkartrace[i] = 0;
  2536. playerinminigame[i] = 0;
  2537. SetPlayerVirtualWorld(i,0);
  2538. SetPlayerInterior(i, 0);
  2539. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2540. }
  2541. }
  2542. }
  2543. kartplaying = 0;
  2544. kartrank = 0;
  2545. karton = 0;
  2546. RespawnKarts();
  2547. SendClientMessageToAll(0x33AA33AA, "The kart race has ended");
  2548. return 1;
  2549. }
  2550.  
  2551. public SrFinish()
  2552. {
  2553. for(new i = 0; i <= MAX_PLAYERS; i++)
  2554. {
  2555. if(IsPlayerConnected(i))
  2556. {
  2557. if (playerinsr[i] == 1)
  2558. {
  2559. playerinsr[i] = 0;
  2560. playerinminigame[i] = 0;
  2561. SetPlayerVirtualWorld(i,0);
  2562. SetPlayerInterior(i, 0);
  2563. SetPlayerPos(i, spawnX, spawnY, spawnZ);
  2564. }
  2565. }
  2566. }
  2567. srplaying = 0;
  2568. srrank = 0;
  2569. sron = 0;
  2570. RespawnNrgs();
  2571. SendClientMessageToAll(0x33AA33AA, "The stadium race has ended");
  2572. return 1;
  2573. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement