Rei_Ayanami

[FS] MiniGames (@Edit: Adicionei uma nova arma no Evento DM)

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