Advertisement
Guest User

Aurimas

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