Bulletje

Untitled

Feb 20th, 2017
52
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.30 KB | None | 0 0
  1. /*
  2. Script by: Bullet
  3. Map by: Bullet
  4. Mission Base: Team Deathmatch
  5. Mission Type: Team Deathmatch
  6. Mission Type ID: 6
  7. */
  8. //==============================================================================
  9. // Includes
  10. //==============================================================================
  11. #include <a_samp>
  12. #include <crashdetect>
  13. #include <float>
  14. #include <fixes2>
  15.  
  16. #include "..\filterscripts\MM\stuff\defines"
  17. #include "..\filterscripts\MM\stuff\serverkeymsg"
  18.  
  19. //==============================================================================
  20. // Defines
  21. //==============================================================================
  22.  
  23. #define MISSION_NAME "Drainage"
  24. #define Health 99.0
  25. #define TEAM_DEFEND_NAME "Federal Agent"
  26. #define TEAM_ATTACK_NAME "County Sheriff"
  27. #define MAX_MAP_OBJECTS 106
  28. #define VEHICLE_HEALTH 0
  29. #define CLASS_POSTION 4141.5347,2121.2827,23.2835
  30. #define CLASS_CAMERA 4142.8501,2116.5156,23.2835
  31. #define CLASS_FACING_AGNLE 198.6635
  32. #define SINKING false
  33. #define SPAWN_PROTECTION true
  34.  
  35. //==============================================================================
  36. // Per mission functions
  37. //==============================================================================
  38.  
  39. enum ped_enum
  40. {
  41. TeamID,
  42. Skin,
  43. Float:SpawnX,
  44. Float:SpawnY,
  45. Float:SpawnZ,
  46. Float:SpawnAngle,
  47. SpawnInterior,
  48. VirtualWorld,
  49. Weapon1,
  50. Ammo1,
  51. Weapon2,
  52. Ammo2,
  53. Weapon3,
  54. Ammo3,
  55. };
  56.  
  57.  
  58. new PedInfo[][ped_enum] = {
  59.  
  60. {TEAM_ATTACK, 283, 4123.7314,2188.5642,17.2619,359.7547,0,0,WEAPON_SNIPER,9999,0,0,0,0},
  61. {TEAM_DEFEND, 286, 4082.3262,2091.0059,15.5818,179.5620,0,0,WEAPON_SNIPER,9999,0,0,0,0}
  62. };
  63.  
  64. #if SINKING == true
  65. new MapSkining[2];
  66. #endif
  67.  
  68. #if MAX_MAP_OBJECTS != 0
  69. new Object[MAX_MAP_OBJECTS];
  70.  
  71. CreateMap()
  72. {
  73. Object[0] = CreateObject(8,4092.4409200,2119.9299300,11.3761000,0.0000000,0.0000000,0.0000000); //
  74. Object[1] = CreateObject(8210,4100.4570300,2189.3310500,17.5001000,0.0000000,0.0000000,-90.0000000); //
  75. Object[2] = CreateObject(8210,4100.3671900,2133.8305700,17.5001000,0.0000000,0.0000000,-90.0000000); //
  76. Object[3] = CreateObject(8210,4127.6860400,2051.7866200,17.4830800,0.0000000,0.0000000,-180.0000500); //
  77. Object[4] = CreateObject(8210,4155.6899400,2135.2675800,17.5001000,0.0000000,0.0000000,-90.0000000); //
  78. Object[5] = CreateObject(8210,4155.6860400,2190.8120100,17.5001000,0.0000000,0.0000000,-90.0000000); //
  79. Object[6] = CreateObject(8210,4127.6987300,2217.2417000,17.5001000,0.0000000,0.0000000,-180.0000000); //
  80. Object[7] = CreateObject(8071,4120.8911100,2136.3532700,15.6869000,0.0000000,0.0000000,90.0000000); //
  81. Object[8] = CreateObject(7249,4185.9287100,2161.4311500,23.5581300,0.0000000,0.0000000,-180.0601200); //
  82. Object[9] = CreateObject(12919,4123.4995100,2191.8278800,14.6221400,0.0000000,0.0000000,-269.9999100); //
  83. Object[10] = CreateObject(8210,4155.6694300,2079.7111800,17.5001000,0.0000000,0.0000000,-90.0000000); //
  84. Object[11] = CreateObject(3885,4123.0488300,2203.8051800,18.7224300,0.0000000,0.0000000,-21.8400000); //
  85. Object[12] = CreateObject(5291,4158.1157200,2220.0986300,25.7798900,0.0000000,0.0000000,-138.7200200); //
  86. Object[13] = CreateObject(3286,4140.7856400,2171.0324700,19.2845200,0.0000000,0.0000000,-87.0600000); //
  87. Object[14] = CreateObject(8653,4115.0625000,2142.6298800,15.4524300,0.0000000,0.0000000,-90.0000300); //
  88. Object[15] = CreateObject(14409,4145.9594700,2126.2421900,17.5554900,0.0000000,0.0000000,0.0000000); //
  89. Object[16] = CreateObject(8838,4143.3510700,2105.9948700,20.7529000,0.0000000,0.0000000,90.0000000); //
  90. Object[17] = CreateObject(8838,4148.4287100,2121.1584500,5.5882800,0.0000000,90.0000000,90.0000000); //
  91. Object[18] = CreateObject(8838,4143.3330100,2121.1848100,5.5883000,0.0000000,90.0000000,90.0000000); //
  92. Object[19] = CreateObject(8838,4148.4711900,2105.9982900,20.7529000,0.0000000,0.0000000,90.0000000); //
  93. Object[20] = CreateObject(8838,4143.3173800,2090.8225100,5.5883000,0.0000000,90.0000000,-90.0000000); //
  94. Object[21] = CreateObject(8838,4148.4526400,2090.8203100,5.5883000,0.0000000,90.0000000,-90.0000000); //
  95. Object[22] = CreateObject(8838,4142.2890600,2106.0231900,19.6997800,270.0000000,0.0000000,90.0000000); //
  96. Object[23] = CreateObject(8838,4142.2890600,2106.0231900,14.5794100,270.0000000,0.0000000,90.0000000); //
  97. Object[24] = CreateObject(3628,4147.8129900,2152.6872600,10.5907400,0.0000000,0.0000000,0.0000000); //
  98. Object[25] = CreateObject(3628,4147.8105500,2173.7434100,10.5907400,0.0000000,0.0000000,0.0000000); //
  99. Object[26] = CreateObject(3628,4147.8115200,2194.7956500,10.5907400,0.0000000,0.0000000,0.0000000); //
  100. Object[27] = CreateObject(3628,4147.8125000,2131.6098600,10.5907400,0.0000000,0.0000000,0.0000000); //
  101. Object[28] = CreateObject(3628,4147.7363300,2110.5730000,10.5907400,0.0000000,0.0000000,0.0000000); //
  102. Object[29] = CreateObject(3628,4147.7866200,2089.5117200,10.5907400,0.0000000,0.0000000,0.0000000); //
  103. Object[30] = CreateObject(3628,4147.7700200,2068.4321300,10.5907400,0.0000000,0.0000000,0.0000000); //
  104. Object[31] = CreateObject(3628,4147.7705100,2047.3533900,10.5907400,0.0000000,0.0000000,0.0000000); //
  105. Object[32] = CreateObject(3628,4163.5166000,2083.5844700,10.5907400,0.0000000,0.0000000,0.0000000); //
  106. Object[33] = CreateObject(3628,4161.7900400,2194.7905300,10.5907400,0.0000000,0.0000000,0.0000000); //
  107. Object[34] = CreateObject(3628,4161.8559600,2173.6948200,10.5907400,0.0000000,0.0000000,0.0000000); //
  108. Object[35] = CreateObject(3628,4161.8540000,2152.6364700,10.5907400,0.0000000,0.0000000,0.0000000); //
  109. Object[36] = CreateObject(3628,4161.8457000,2131.5700700,10.5907400,0.0000000,0.0000000,0.0000000); //
  110. Object[37] = CreateObject(3628,4161.7788100,2110.5485800,10.5907400,0.0000000,0.0000000,0.0000000); //
  111. Object[38] = CreateObject(3628,4161.8369100,2089.4724100,10.5907400,0.0000000,0.0000000,0.0000000); //
  112. Object[39] = CreateObject(3628,4161.8115200,2068.4331100,10.5907400,0.0000000,0.0000000,0.0000000); //
  113. Object[40] = CreateObject(3628,4161.8149400,2047.3710900,10.5907400,0.0000000,0.0000000,0.0000000); //
  114. Object[41] = CreateObject(12921,4100.3632800,2131.4099100,17.8798200,0.0000000,0.0000000,-269.9997900); //
  115. Object[42] = CreateObject(8210,4072.3759800,2105.8850100,17.5001000,0.0000000,0.0000000,-180.0600000); //
  116. Object[43] = CreateObject(8210,4062.5615200,2089.1252400,17.5001000,0.0000000,0.0000000,-90.0600000); //
  117. Object[44] = CreateObject(7250,4052.1965300,2004.6585700,6.7860100,0.0000000,0.0000000,-270.1800200); //
  118. Object[45] = CreateObject(7249,4214.2485400,2057.4160200,23.5581300,0.0000000,0.0000000,-232.9200700); //
  119. Object[46] = CreateObject(8210,4072.1501500,2051.7922400,17.4934300,0.0000000,0.0000000,-180.0000500); //
  120. Object[47] = CreateObject(7250,4015.5730000,2126.2922400,-5.8957000,0.0000000,0.0000000,-360.0603600); //
  121. Object[48] = CreateObject(8210,4063.9826700,2033.6689500,17.5001000,0.0000000,0.0000000,-87.0599900); //
  122. Object[49] = CreateObject(7250,4143.5727500,2263.2990700,11.2249700,0.0000000,0.0000000,-90.1199900); //
  123. Object[50] = CreateObject(8210,4127.7670900,2214.9206500,17.5001000,0.0000000,0.0000000,-180.0001700); //
  124. Object[51] = CreateObject(3628,4147.7578100,2215.8498500,10.5907400,0.0000000,0.0000000,0.0000000); //
  125. Object[52] = CreateObject(3628,4161.8222700,2215.8476600,10.5907400,0.0000000,0.0000000,0.0000000); //
  126. Object[53] = CreateObject(7250,4040.0622600,2165.3918500,-5.8957000,0.0000000,0.0000000,-384.7803300); //
  127. Object[54] = CreateObject(18250,4081.8461900,2086.0534700,20.6364600,0.0000000,0.0000000,0.0000000); //
  128. Object[55] = CreateObject(3279,4069.9477500,2058.6591800,14.4251200,0.0000000,0.0000000,0.0000000); //
  129. Object[56] = CreateObject(3249,4118.5073200,2100.2275400,14.5895000,0.0000000,0.0000000,-90.0000000); //
  130. Object[57] = CreateObject(3246,4130.0913100,2071.5993700,14.5895000,0.0000000,0.0000000,-90.0000000); //
  131. Object[58] = CreateObject(3244,4147.6699200,2063.8090800,14.5895000,0.0000000,0.0000000,-90.0000000); //
  132. Object[59] = CreateObject(3253,4114.9531300,2077.4653300,14.5895000,0.0000000,0.0000000,-90.0000000); //
  133. Object[60] = CreateObject(17039,4106.2456100,2153.1523400,14.5555000,0.0000000,0.0000000,-0.1200100); //
  134. Object[61] = CreateObject(17000,4107.2168000,2207.3781700,14.2716400,0.0000000,0.0000000,0.0000000); //
  135. Object[62] = CreateObject(16406,4112.0546900,2059.8115200,19.1236800,0.0000000,0.0000000,0.0000000); //
  136. Object[63] = CreateObject(17060,4126.0073200,2121.9023400,14.1606700,0.0000000,0.0000000,-179.9999400); //
  137. Object[64] = CreateObject(17074,4141.6191400,2196.4746100,14.5148000,0.0000000,0.0000000,0.0000000); //
  138. Object[65] = CreateObject(1458,4071.5571300,2084.7482900,14.9393000,0.0000000,0.0000000,-107.7000000); //
  139. Object[66] = CreateObject(1457,4090.8076200,2087.7836900,16.2930900,0.0000000,0.0000000,0.0000000); //
  140. Object[67] = CreateObject(1483,4133.0971700,2141.1569800,16.2763600,0.0000000,0.0000000,-89.9999800); //
  141. Object[68] = CreateObject(1483,4133.0815400,2137.4499500,16.2763600,0.0000000,0.0000000,-270.0000300); //
  142. Object[69] = CreateObject(7250,4049.6477100,2230.6323200,-5.5715000,0.0000000,0.0000000,-356.1004900); //
  143. Object[70] = CreateObject(18013,4146.8920900,2098.4763200,20.1680000,0.0000000,0.0000000,90.0000000); //
  144. Object[71] = CreateObject(18013,4146.8813500,2113.7258300,20.1680000,0.0000000,0.0000000,90.0000000); //
  145. Object[72] = CreateObject(18013,4146.8676800,2109.2270500,20.1680200,0.0000000,0.0000000,90.0000200); //
  146. Object[73] = CreateObject(18013,4146.8979500,2105.0053700,20.1680000,0.0000000,0.0000000,90.0000000); //
  147. Object[74] = CreateObject(8838,4153.5727500,2106.0083000,20.7529000,0.0000000,0.0000000,-90.0000000); //
  148. Object[75] = CreateObject(17060,4112.0263700,2120.7714800,14.1606700,0.0000000,0.0000000,-179.9999400); //
  149. Object[76] = CreateObject(3364,4148.1645500,2152.7780800,14.5510800,0.0000000,0.0000000,0.0000000); //
  150. Object[77] = CreateObject(18609,4080.3293500,2092.6975100,15.6354400,0.0000000,0.0000000,0.0000000); //
  151. Object[78] = CreateObject(17030,4062.9267600,2115.5681200,13.4331100,0.0000000,0.0000000,-307.9801300); //
  152. Object[79] = CreateObject(17030,4063.1438000,2116.1489300,22.0727500,15.5400000,-3.5399900,-307.9801300); //
  153. Object[80] = CreateObject(17030,4061.8386200,2116.2004400,27.7001000,15.5400000,-3.5399900,-307.9801300); //
  154. Object[81] = CreateObject(3363,4124.9594700,2158.4860800,14.5872200,0.0000000,0.0000000,0.0000000); //
  155. Object[82] = CreateObject(14875,4105.8403300,2175.8916000,15.3631700,0.0000000,0.0000000,0.0000000); //
  156. Object[83] = CreateObject(14875,4107.5410200,2174.9545900,15.3631700,0.0000000,0.0000000,0.0000000); //
  157. Object[84] = CreateObject(3252,4085.4282200,2059.6499000,14.5895000,0.0000000,0.0000000,-90.0000000); //
  158. Object[85] = CreateObject(3285,4096.0659200,2060.2382800,16.3421500,0.0000000,0.0000000,-90.0000000); //
  159. Object[86] = CreateObject(14875,4109.3486300,2174.0114700,15.3631700,0.0000000,0.0000000,0.0000000); //
  160. Object[87] = CreateObject(11364,-2073.7109400,-859.9453100,30.5703100,0.0000000,0.0000000,0.0000000); //
  161. Object[88] = CreateObject(16302,4118.6162100,2095.8767100,12.9404100,0.0000000,0.0000000,-91.2000000); //
  162. Object[89] = CreateObject(3280,4123.3237300,2178.7385300,17.9888300,0.0000000,0.0000000,0.0000000); //
  163. Object[90] = CreateObject(3278,4124.2939500,2176.8466800,20.1450400,0.0000000,0.0000000,0.0000000); //
  164. Object[91] = CreateObject(3278,4122.2724600,2176.8701200,20.1450400,0.0000000,0.0000000,0.0000000); //
  165. Object[92] = CreateObject(3278,4122.2724600,2176.8701200,19.5978900,0.0000000,0.0000000,0.0000000); //
  166. Object[93] = CreateObject(3278,4124.7192400,2176.9160200,19.5978900,0.0000000,0.0000000,0.0000000); //
  167. Object[94] = CreateObject(3278,4116.3046900,2201.0449200,15.5561000,0.0000000,0.0000000,90.0000300); //
  168. Object[95] = CreateObject(3278,4116.2690400,2198.6350100,15.5561000,0.0000000,0.0000000,90.0000300); //
  169. Object[96] = CreateObject(3278,4130.9502000,2180.4003900,15.5561000,0.0000000,0.0000000,90.0000300); //
  170. Object[97] = CreateObject(3278,4130.9692400,2182.8298300,15.5561000,0.0000000,0.0000000,90.0000300); //
  171. Object[98] = CreateObject(8171,4022.9270000,2106.1980000,15.8115100,0.0000000,-90.0000000,-90.0000200); //
  172. Object[99] = CreateObject(8171,4061.9731400,2040.3776900,25.2540000,0.0000000,-90.0000000,-0.0000100); //
  173. Object[100] = CreateObject(8171,4115.7348600,2051.5908200,23.9922700,0.0000000,-90.0000000,89.8199300); //
  174. Object[101] = CreateObject(8171,4155.9555700,2120.1997100,23.9922700,0.0000000,-90.0000000,180.0000500); //
  175. Object[102] = CreateObject(8171,4155.9736300,2257.6821300,23.9922700,0.0000000,-90.0000000,180.0000500); //
  176. Object[103] = CreateObject(8171,4089.9292000,2215.5095200,23.9922700,0.0000000,-90.0000000,269.9996600); //
  177. Object[104] = CreateObject(17030,4065.4814500,2117.9951200,24.1583300,27.7200000,-4.0199900,-312.8399700); //
  178. Object[105] = CreateObject(8171,4099.9692400,2217.8371600,25.2540000,0.0000000,-90.0000000,0.0000300); //
  179. }
  180. #endif
  181.  
  182. //==============================================================================
  183. // Basic vars
  184. //==============================================================================
  185.  
  186. new bool:MissionStarted;
  187. new bool:ObjectiveStarted;
  188. new bool:MissionCancelled;
  189.  
  190. native IsValidVehicle(vehicleid);
  191.  
  192. enum teamdata
  193. {
  194. Kills,
  195. Name[32],
  196. Members
  197. };
  198.  
  199. enum playerdata
  200. {
  201. UserName[MAX_PLAYER_NAME],
  202. bool:Counted,
  203. TeamSelection,
  204. PlayerClassID
  205. };
  206.  
  207. new Team[2][teamdata];
  208. new PlayerMissionInfo[MAX_PLAYERS][playerdata];
  209.  
  210. //==============================================================================
  211. // Basic script
  212. //==============================================================================
  213.  
  214. main()
  215. {
  216. print("----------------------------------");
  217. print(" Mission: "MISSION_NAME" started.");
  218. print("----------------------------------\n");
  219. }
  220.  
  221. public OnGameModeInit()
  222. {
  223. MissionStarted= true;
  224.  
  225. format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
  226. format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
  227.  
  228. if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
  229.  
  230. #if MAX_MAP_OBJECTS != 0
  231. CreateMap();
  232. #endif
  233.  
  234. for(new i=0; i<sizeof(PedInfo); i++)AddPlayerClassEx(PedInfo[i][TeamID],PedInfo[i][Skin],PedInfo[i][SpawnX],PedInfo[i][SpawnY],PedInfo[i][SpawnZ],PedInfo[i][SpawnAngle],0,0,0,0,0,0);
  235.  
  236. #if SINKING == true
  237. MapSkining[0] = SetTimer("SinkMap", 80*1000, false);
  238. #endif
  239.  
  240. for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
  241. for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
  242.  
  243. SetTimer("StartMissionFunc",3000,false);
  244. return 1;
  245. }
  246.  
  247. FUNCTION StartMissionFunc()
  248. {
  249. CallRemoteFunction("StartMission","");
  250. ObjectiveStarted= true;
  251. return 1;
  252. }
  253.  
  254. public OnGameModeExit()
  255. {
  256. #if MAX_MAP_OBJECTS != 0
  257. for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
  258. #endif
  259. return 1;
  260. }
  261.  
  262. public OnPlayerDisconnect(playerid)
  263. {
  264. if(PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM && PlayerMissionInfo[playerid][Counted])
  265. {
  266. Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
  267. PlayerMissionInfo[playerid][Counted] = false;
  268. }
  269. return 1;
  270. }
  271.  
  272. public OnPlayerRequestClass(playerid,classid)
  273. {
  274. SetPlayerPos(playerid,CLASS_POSTION);
  275. SetPlayerCameraPos(playerid,CLASS_CAMERA);
  276. SetPlayerCameraLookAt(playerid,CLASS_POSTION);
  277. SetPlayerFacingAngle(playerid,CLASS_FACING_AGNLE);
  278.  
  279. CallRemoteFunction("TdmHide","i",playerid);
  280. CallRemoteFunction("ShowClassSelection","ddsddd",playerid, PedInfo[classid][TeamID],Team[PedInfo[classid][TeamID]][Name], PedInfo[classid][Weapon1], PedInfo[classid][Weapon2], PedInfo[classid][Weapon3]);
  281. if(PlayerMissionInfo[playerid][Counted] && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM)
  282. {
  283. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
  284. PlayerMissionInfo[playerid][Counted] = false;
  285. }
  286. PlayerMissionInfo[playerid][TeamSelection] = PedInfo[classid][TeamID];
  287. PlayerMissionInfo[playerid][PlayerClassID]=classid;
  288. return 1;
  289. }
  290.  
  291. public OnPlayerRequestSpawn(playerid)
  292. {
  293. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  294. if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
  295. {
  296. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,"This Team is full, choose another!",0);
  297. return 0;
  298. }
  299. return 1;
  300. }
  301. public OnPlayerSpawn(playerid)
  302. {
  303. new string[124];
  304. CallRemoteFunction("UpdateAliveState","ii",playerid,1);
  305. CallRemoteFunction("TdmShow","i",playerid);
  306. CallRemoteFunction("TdmUpdate","sssdd","Kills",Team[TEAM_DEFEND][Name],Team[TEAM_ATTACK][Name],Team[TEAM_DEFEND][Kills],Team[TEAM_ATTACK][Kills]);
  307. SetPlayerHealth(playerid,Health);
  308. if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
  309. if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
  310. else
  311. {
  312. SetPlayerPos(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
  313. SetPlayerFacingAngle(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
  314. SetPlayerInterior(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
  315. SetPlayerVirtualWorld(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
  316. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
  317. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
  318. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
  319. if(!PlayerMissionInfo[playerid][Counted])
  320. {
  321. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
  322. PlayerMissionInfo[playerid][Counted] = true;
  323. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  324. format(string,sizeof(string),"You have chosen team %s, your mission is to kill %s.",Team[PlayerMissionInfo[playerid][TeamSelection]][Name],Team[opp_team][Name]);
  325. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,0);
  326. format(string,sizeof(string),"~r~~h~Eliminate ~w~%s.",Team[opp_team][Name]);
  327. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1,string,0);
  328. }
  329. }
  330. SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
  331. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
  332. else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
  333. #if SPAWN_PROTECTION == true
  334. CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
  335. #endif
  336. return 1;
  337. }
  338.  
  339. public OnPlayerDeath(playerid, killerid, reason)
  340. {
  341. if(killerid != INVALID_PLAYER_ID && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM && MissionStarted)
  342. {
  343. Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
  344. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  345. CallRemoteFunction("TdmUpdate","sssdd","Kills",Team[TEAM_DEFEND][Name],Team[TEAM_ATTACK][Name],Team[TEAM_DEFEND][Kills],Team[TEAM_ATTACK][Kills]);
  346. }
  347. CallRemoteFunction("UpdateAliveState","ii",playerid,0);
  348. return 1;
  349. }
  350.  
  351. public OnVehicleSpawn(vehicleid)
  352. {
  353. SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
  354. return 1;
  355. }
  356.  
  357. FUNCTION EndTheMission()
  358. {
  359. if(!MissionStarted) return 1;
  360. MissionStarted= false;
  361. if(!MissionCancelled)
  362. {
  363. new string[256];
  364. new amount= 10000;
  365. new winning_team;
  366. if(Team[TEAM_DEFEND][Kills] == Team[TEAM_ATTACK][Kills]) { winning_team = 2; }
  367. else if(Team[TEAM_DEFEND][Kills] > Team[TEAM_ATTACK][Kills]) { winning_team = 0; }
  368. else { winning_team = 1; }
  369.  
  370. if(winning_team != 2)
  371. {
  372. amount =amount+(Team[winning_team][Kills]*100);
  373. format(string,sizeof(string),""SERVER_KEY_MSG" %s has won the team deathmatch! Reward: $%d",Team[winning_team][Name],amount);
  374. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  375. SendClientMessageToAll(COLOR_SERVER,string);
  376. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the team deathmatch!",amount);
  377. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  378. {
  379. if(PlayerMissionInfo[i][TeamSelection] == winning_team && PlayerMissionInfo[i][Counted])
  380. {
  381. PlayerPlaySound(i,3200,0,0,0);
  382. SendClientMessage(i,COLOR_SERVER,string);
  383. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  384. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  385. CallRemoteFunction("PlayerMissionStats","dd",i,6);
  386. }
  387. if(PlayerMissionInfo[i][TeamSelection] != winning_team && PlayerMissionInfo[i][Counted])
  388. {
  389. PlayerPlaySound(i,17004,0,0,0);
  390. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  391. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  392. }
  393. }
  394. }
  395. else
  396. {
  397. PlaySoundForAll(1058);
  398. format(string,sizeof(string),""SERVER_KEY_MSG" IT'S A DRAW! No team has won the team-deathmatch.");
  399. SendClientMessageToAll(COLOR_SERVER,string);
  400. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  401. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++) if(IsPlayerConnected(i) && PlayerMissionInfo[i][Counted]) CallRemoteFunction("PlayerMissionStats","dd",i,2);
  402. }
  403. }
  404. else
  405. {
  406. PlaySoundForAll(1058);
  407. SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
  408. CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
  409. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
  410. GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
  411. }
  412. return 1;
  413. }
  414.  
  415. //==============================================================================
  416. // Mission functions
  417. //==============================================================================
  418.  
  419. #if SINKING == true
  420. FUNCTION SinkMap()
  421. {
  422. GameTextForAll("~r~the island is sinking!",4000,3);
  423. new Float:X, Float:Y, Float:Z;
  424. new Float:oldRotX, Float:oldRotY, Float:oldRotZ;
  425.  
  426. for(new i = 0; i < MAX_MAP_OBJECTS; i++) { GetObjectPos(Object[i], X, Y, Z), GetObjectRot(Object[i], oldRotX, oldRotY, oldRotZ); MoveObject(Object[i], X, Y, Z-40, 0.6, oldRotX, oldRotY, oldRotZ+0.05); }
  427. MapSkining[0] = SetTimer("ResurfaceMap", 150*1000,false);
  428. return true;
  429. }
  430.  
  431.  
  432. FUNCTION ResurfaceMap()
  433. {
  434. GameTextForAll("~g~the island is resurfacing!",4000,3);
  435. new Float:X, Float:Y, Float:Z;
  436. new Float:oldRotX, Float:oldRotY, Float:oldRotZ;
  437.  
  438. for(new i = 0; i < MAX_MAP_OBJECTS; i++) { GetObjectPos(Object[i], X, Y, Z), GetObjectRot(Object[i], oldRotX, oldRotY, oldRotZ); MoveObject(Object[i], X, Y, Z+40, 0.6, oldRotX, oldRotY, oldRotZ-0.05); }
  439. //MapSkining[1] = SetTimer("SinkMap", 80000,false);
  440. return true;
  441. }
  442. #endif
  443.  
  444. PlaySoundForAll(sound)
  445. {
  446. for (new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  447. {
  448. if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
  449. }
  450. }
  451.  
  452. //==============================================================================
  453. // Important functions required
  454. //==============================================================================
  455.  
  456. FUNCTION OnPlayerNameRecieve(playerid,name[])
  457. {
  458. format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
  459. return 1;
  460. }
  461.  
  462.  
  463. FUNCTION CancelTheMission()
  464. {
  465. MissionCancelled= true;
  466. return 1;
  467. }
  468.  
  469. FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
Add Comment
Please, Sign In to add comment