Bulletje

Untitled

Jan 21st, 2017
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 24.05 KB | None | 0 0
  1. /*
  2. Script by: Bullet
  3. Map by: MiD
  4. Mission Base: Bombing
  5. Mission Type: Checkpoint bombing
  6. Mission Type ID: 1
  7. */
  8. //==============================================================================
  9. // Includes
  10. //==============================================================================
  11. #include <a_samp>
  12. #include <crashdetect>
  13. #include <float>
  14.  
  15. #include "..\filterscripts\MM\stuff\defines"
  16. #include "..\filterscripts\MM\stuff\serverkeymsg"
  17.  
  18. //==============================================================================
  19. // Defines
  20. //==============================================================================
  21.  
  22. #define MISSION_NAME "Drugs on Fire"
  23. #define Health 99.0
  24. #define OBJ_NAME "Drug Factory"
  25. #define CP_POS -2145.6235,-253.9246,40.71
  26. #define CP_SIZE 3.0
  27. #define VEHICLE_HEALTH 999.0
  28. #define CLASS_POSTION -2175.7952,-231.4047,36.5156
  29. #define CLASS_CAMERA -2181.8398,-230.1611,36.5156
  30. #define CLASS_FACING_AGNLE 80.2331
  31. #define TEAM_DEFEND_NAME "Mafia"
  32. #define TEAM_ATTACK_NAME "Police"
  33. #define MAX_MAP_OBJECTS 25
  34. #define PLACING_TIME 7
  35. #define SPAWN_PROTECTION true
  36.  
  37. //==============================================================================
  38. // Per mission functions
  39. //==============================================================================
  40.  
  41. enum skindata
  42. {
  43. TeamID,
  44. SkinID,
  45. Float:SpawnX,
  46. Float:SpawnY,
  47. Float:SpawnZ,
  48. Float:SpawnAngle,
  49. SpawnInterior,
  50. VirtualWorld,
  51. Weapon1,
  52. Ammo1,
  53. Weapon2,
  54. Ammo2,
  55. Weapon3,
  56. Ammo3,
  57. };
  58.  
  59. new const SkinData[][skindata] = {
  60. {TEAM_ATTACK, 281, -1968.8245,132.1389,27.6875,85.1686,0,0,WEAPON_AK47,280,WEAPON_DEAGLE,80,WEAPON_GRENADE,4},
  61. {TEAM_DEFEND, 124,-2104.4385,-209.3291,35.3203,88.8383,0,0,WEAPON_UZI,210,WEAPON_DEAGLE,80,WEAPON_GRENADE,4},
  62. {TEAM_ATTACK, 285, -1982.3809,145.3371,27.6875,92.3754,0,0,WEAPON_MP5,280,WEAPON_SHOTGUN,60,WEAPON_NITESTICK,1},
  63. {TEAM_DEFEND, 127,-2139.7466,-149.0962,36.5049,88.5249,0,0,WEAPON_AK47,280,WEAPON_TEC9,460,WEAPON_COLT45,100}
  64. };
  65.  
  66. new const Float:ExplosionsInfo[][3] = {
  67. {2463.1211,-1666.8960,13.4766},
  68. {-2188.9060,-255.0842,42.0237},
  69. {-2155.7180,-263.3134,46.3872},
  70. {-2150.1221,-254.0361,46.7895},
  71. {-2157.1211,-226.5739,36.5220},
  72. {-2161.6814,-237.6113,36.5156},
  73. {-2171.2822,-236.9347,36.5156},
  74. {-2176.3674,-238.9926,36.5220},
  75. {-2167.3220,-226.4747,44.9798},
  76. {-2177.0344,-219.0716,42.0465},
  77. {-2183.0071,-205.9743,36.5156},
  78. {-2189.6252,-212.8108,36.5156},
  79. {-2188.7437,-236.2425,38.2537},
  80. {-2142.8762,-238.3528,36.5156},
  81. {-2139.3860,-239.9258,40.4382},
  82. {-2143.7202,-226.9313,36.5156},
  83. {-2159.0354,-247.5820,36.5156},
  84. {-2168.2815,-248.9831,36.5156},
  85. {-2160.4912,-265.4875,36.5156},
  86. {-2147.0493,-256.4703,36.5156},
  87. {-2139.8860,-257.0020,36.5156},
  88. {-2139.9958,-266.9616,36.5156},
  89. {-2173.4524,-259.3654,45.7206},
  90. {-2180.5532,-263.2342,46.1229}
  91. };
  92.  
  93. #if MAX_MAP_OBJECTS != 0
  94. new Object[MAX_MAP_OBJECTS];
  95.  
  96. CreateMap()
  97. {
  98. AddStaticVehicle(469,-2155.0896,-182.9428,41.1414,359.5534,75,2); // Seasprrow
  99. AddStaticVehicle(459,-2114.1033,-273.2192,35.3746,356.1795,57,57); // vehicle
  100. AddStaticVehicle(459,-2109.4753,-273.4923,35.3717,356.4679,51,51); // vehicle
  101. AddStaticVehicle(459,-2105.0156,-273.7660,35.3747,357.7630,44,44); // vehicle
  102. AddStaticVehicle(459,-2100.6897,-274.1206,35.3780,359.9228,28,28); // vehicle
  103. AddStaticVehicle(459,-2173.0427,-214.9930,35.3745,267.9830,106,106); // vehicle
  104. AddStaticVehicle(459,-2173.1787,-220.1465,35.3811,269.1607,72,72); // vehicle
  105. AddStaticVehicle(515,-2104.1182,-200.1182,36.3352,89.1038,24,77); // vehicl
  106. AddStaticVehicle(415,-2132.4341,-114.3199,35.0958,179.4082,25,1); // veh
  107. AddStaticVehicle(415,-2129.0193,-114.3530,35.4746,179.4082,25,1); // veh
  108. AddStaticVehicle(415,-2124.7090,-114.3953,35.8579,179.4082,25,1); // veh
  109. AddStaticVehicle(415,-2120.3147,-114.4386,36.2303,179.4082,25,1); // veh
  110. AddStaticVehicle(415,-2115.7393,-114.4850,36.3720,179.4082,25,1); // veh
  111. AddStaticVehicle(515,-2102.5945,-88.8966,36.3471,90.8843,63,78); // veh
  112. AddStaticVehicle(429,-2022.3447,-98.4749,34.8437,359.3260,13,13); // veh
  113. AddStaticVehicle(459,-2150.2522,-146.5753,36.5102,359.6807,112,112); // car
  114. AddStaticVehicle(597,-1993.2491,98.7554,27.3763,90.5661,0,1); // VEHICLECOP
  115. AddStaticVehicle(597,-1987.0876,110.7273,27.3814,179.6695,0,1); // VEHICLECOP
  116. AddStaticVehicle(597,-1987.0673,118.4010,27.3780,180.4700,0,1); // VEHICLECOP
  117. AddStaticVehicle(597,-1987.1235,125.5648,27.3811,180.4953,0,1); // VEHICLECOP
  118. AddStaticVehicle(597,-1987.1433,133.0636,27.3806,180.0091,0,1); // VEHICLECOP
  119. AddStaticVehicle(597,-1987.2098,140.3433,27.3803,180.5386,0,1); // VEHICLECOP
  120. AddStaticVehicle(597,-1987.1925,148.1132,27.3804,180.5220,0,1); // VEHICLECOP
  121. AddStaticVehicle(597,-1987.2200,155.0967,27.3803,180.1163,0,1); // VEHICLECOP
  122. AddStaticVehicle(597,-1987.2388,162.4059,27.3818,180.3669,0,1); // VEHICLECOP
  123. AddStaticVehicle(528,-1992.7528,197.4871,27.6491,90.5871,0,0); // VEHICLECOP
  124. AddStaticVehicle(415,-1987.2097,177.7588,27.3810,359.8402,62,1); // VEHICLECOP
  125. AddStaticVehicle(415,-1987.2341,188.1376,27.3794,0.1473,62,1); // VEHICLECOP
  126.  
  127. Object[0] = CreateObject(944,-2162.8798828,-227.0681610,36.4004135,0.0000000,0.0000000,272.0000000); //object(packing_carates04)(1)
  128. Object[1] = CreateObject(971,-2135.4816890,-154.1937410,37.8901670,0.0000000,0.0000000,-56.2500170); //object
  129. Object[2] = CreateObject(971,-2131.3188480,-161.9702450,37.8901670,0.0000000,0.0000000,-67.4999860); //object(1)
  130. Object[3] = CreateObject(971,-2128.9094240,-170.3375240,37.9651870,0.0000000,0.0000000,-78.7500123); //object(2)
  131. Object[4] = CreateObject(971,-2127.5214840,-179.0550840,37.9152300,0.0000000,0.0000000,-83.9839244); //object(3)
  132. Object[5] = CreateObject(1271,-2180.6364750,-207.3528290,35.8656230,0.0000000,0.0000000,0.0000000); //object(7)
  133. Object[6] = CreateObject(1271,-2180.6521000,-208.1038820,35.8656230,0.0000000,0.0000000,0.0000000); //object(8)
  134. Object[7] = CreateObject(1271,-2180.6682130,-208.8349760,35.8656230,0.0000000,0.0000000,0.0000000); //object(9)
  135. Object[8] = CreateObject(1271,-2180.6503910,-209.5831760,35.8656230,0.0000000,0.0000000,0.0000000); //object(10)
  136. Object[9] = CreateObject(1271,-2180.6525880,-210.3245850,35.8656230,0.0000000,0.0000000,0.0000000); //object(11)
  137. Object[10] = CreateObject(1271,-2180.6550290,-211.0502620,35.8656230,0.0000000,0.0000000,0.0000000); //object(12)
  138. Object[11] = CreateObject(1271,-2180.6828610,-211.7620540,35.8656230,0.0000000,0.0000000,0.0000000); //object(13)
  139. Object[12] = CreateObject(1271,-2180.6379390,-207.3715520,36.5565910,0.0000000,0.0000000,0.0000000); //object(14)
  140. Object[13] = CreateObject(1271,-2180.6586910,-208.1345370,36.5565910,0.0000000,0.0000000,0.0000000); //object(15)
  141. Object[14] = CreateObject(1271,-2180.6762700,-208.8878780,36.5565910,0.0000000,0.0000000,0.0000000); //object(16)
  142. Object[15] = CreateObject(1271,-2180.6958010,-209.6635130,36.5565910,0.0000000,0.0000000,0.0000000); //object(17)
  143. Object[16] = CreateObject(1271,-2180.6857910,-210.4110570,36.5565910,0.0000000,0.0000000,0.0000000); //object(18)
  144. Object[17] = CreateObject(1271,-2180.6452640,-211.1673580,36.5455360,0.0000000,0.0000000,0.0000000); //object(19)
  145. Object[18] = CreateObject(1271,-2180.6599120,-208.1043850,37.2475590,0.0000000,0.0000000,0.0000000); //object(20)
  146. Object[19] = CreateObject(1271,-2180.6657710,-208.9075930,37.2475590,0.0000000,0.0000000,0.0000000); //object(21)
  147. Object[20] = CreateObject(1271,-2180.6560060,-209.6454620,37.2475590,0.0000000,0.0000000,0.0000000); //object(22)
  148. Object[21] = CreateObject(1271,-2180.6809080,-210.4202730,37.2475590,0.0000000,0.0000000,0.0000000); //object(23)
  149. Object[22] = CreateObject(1271,-2180.6552730,-211.1438290,37.2365040,0.0000000,0.0000000,0.0000000); //object(24)
  150. Object[23] = CreateObject(1271,-2180.6992190,-208.8907010,37.9385260,0.0000000,0.0000000,0.0000000); //object(25)
  151. Object[24] = CreateObject(1271,-2180.6992190,-210.4153290,37.9385260,0.0000000,0.0000000,0.0000000); //object(26)
  152. }
  153. #endif
  154.  
  155.  
  156. //==============================================================================
  157. // Basic vars
  158. //==============================================================================
  159.  
  160. new bool:MissionStarted;
  161. new bool:ObjectiveStarted;
  162. new bool:MissionCancelled;
  163.  
  164. new bool:ObjectivePlaced;
  165.  
  166. native IsValidVehicle(vehicleid);
  167.  
  168. enum obj
  169. {
  170. ObjectiveName[30],
  171. BeingPlaced,
  172. ObjectiveTimer,
  173. ProgressTimer,
  174. ProgressCount,
  175. Count
  176. };
  177.  
  178. enum teamdata
  179. {
  180. Name[32],
  181. Members,
  182. Kills
  183. };
  184.  
  185. enum playerdata
  186. {
  187. UserName[MAX_PLAYER_NAME],
  188. bool:TeamChosen,
  189. TeamSelection,
  190. PlayerClassID
  191. };
  192.  
  193. new Team[2][teamdata];
  194. new PlayerMissionInfo[MAX_PLAYERS][playerdata];
  195. new ObjectiveInfo[obj];
  196.  
  197. new MaxExplosions;
  198. new FlashTimer;
  199.  
  200. //==============================================================================
  201. // Basic script
  202. //==============================================================================
  203.  
  204. main()
  205. {
  206. print("----------------------------------");
  207. print(" Mission: "MISSION_NAME" started.");
  208. print("----------------------------------\n");
  209. }
  210.  
  211. public OnGameModeInit()
  212. {
  213. MissionStarted= true;
  214. format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
  215. format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
  216.  
  217. format(ObjectiveInfo[ObjectiveName],sizeof(ObjectiveInfo[ObjectiveName]),"%s",OBJ_NAME);
  218.  
  219. CallRemoteFunction("CreateBombingTD","d",PLACING_TIME*10);
  220.  
  221. MaxExplosions= sizeof(ExplosionsInfo);
  222. ObjectivePlaced= false;
  223. ObjectiveInfo[BeingPlaced]=-1;
  224.  
  225. #if MAX_MAP_OBJECTS != 0
  226. CreateMap();
  227. #endif
  228.  
  229. for(new i=0; i<sizeof(SkinData); i++)
  230. {
  231. AddPlayerClassEx(SkinData[i][TeamID],SkinData[i][SkinID],SkinData[i][SpawnX],SkinData[i][SpawnY],SkinData[i][SpawnZ],SkinData[i][SpawnAngle],0,0,0,0,0,0);
  232. }
  233.  
  234. for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
  235.  
  236. for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
  237.  
  238. if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
  239. SetTimer("StartMissionFunc",3000,false);
  240. return 1;
  241. }
  242.  
  243. FUNCTION StartMissionFunc()
  244. {
  245. CallRemoteFunction("StartMission","");
  246. ObjectiveStarted= true;
  247. return 1;
  248. }
  249.  
  250. public OnGameModeExit()
  251. {
  252. #if MAX_MAP_OBJECTS != 0
  253. for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
  254. #endif
  255. for(new i=0; i<MAX_VEHICLES; i++)
  256. {
  257. DestroyVehicle(i);
  258. }
  259. return 1;
  260. }
  261.  
  262. public OnPlayerDisconnect(playerid)
  263. {
  264. if(PlayerMissionInfo[playerid][TeamChosen])
  265. {
  266. Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
  267. PlayerMissionInfo[playerid][TeamChosen]=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("ShowClassSelection","iisiii",playerid, SkinData[classid][TeamID],Team[SkinData[classid][TeamID]][Name], SkinData[classid][Weapon1], SkinData[classid][Weapon2], SkinData[classid][Weapon3]);
  280.  
  281. if(PlayerMissionInfo[playerid][TeamChosen])
  282. {
  283. PlayerMissionInfo[playerid][TeamChosen] = false;
  284. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
  285. }
  286.  
  287. PlayerMissionInfo[playerid][TeamSelection] = SkinData[classid][TeamID];
  288. PlayerMissionInfo[playerid][PlayerClassID]=classid;
  289. return 1;
  290. }
  291.  
  292. public OnPlayerRequestSpawn(playerid)
  293. {
  294. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  295. if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
  296. {
  297. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This Team is full, choose another!",0);
  298. return 0;
  299. }
  300. return 1;
  301. }
  302.  
  303.  
  304. public OnPlayerSpawn(playerid)
  305. {
  306. new string[124];
  307. CallRemoteFunction("UpdateAliveState","ii",playerid,1);
  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,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
  313. SetPlayerInterior(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
  314. SetPlayerFacingAngle(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
  315. SetPlayerVirtualWorld(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
  316. if(!PlayerMissionInfo[playerid][TeamChosen])
  317. {
  318. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
  319. PlayerMissionInfo[playerid][TeamChosen] = true;
  320. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  321. {
  322. format(string,sizeof(string),"You are a %s, your mission is to destroy the %s.",Team[TEAM_ATTACK][Name],ObjectiveInfo[ObjectiveName]);
  323. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  324. format(string,sizeof(string),"%s will try to stop you, eliminate them!.",Team[TEAM_DEFEND][Name]);
  325. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string,4000);
  326. format(string,sizeof(string),"Destroy the ~y~%s~w~!",ObjectiveInfo[ObjectiveName]);
  327. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  328. }
  329. else
  330. {
  331. format(string,sizeof(string),"You are a %s, your mission is to protect the %s from %s.",Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName],Team[TEAM_ATTACK][Name]);
  332. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  333. format(string,sizeof(string),"Protect the ~y~%s~w~!.",ObjectiveInfo[ObjectiveName]);
  334. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  335. }
  336. }
  337. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
  338. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
  339. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
  340. }
  341. SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
  342. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
  343. else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
  344.  
  345. SetPlayerHealth(playerid,Health);
  346. #if SPAWN_PROTECTION == true
  347. CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
  348. #endif
  349.  
  350. CallRemoteFunction("OnPlayerBombingData", "ii", playerid, 1);
  351.  
  352. SetPlayerCheckpoint(playerid,CP_POS,CP_SIZE);
  353. return 1;
  354. }
  355.  
  356. public OnPlayerDeath(playerid, killerid, reason)
  357. {
  358. new string[128];
  359. if(killerid != INVALID_PLAYER_ID)
  360. {
  361. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  362. Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
  363. }
  364. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  365. {
  366. if(!ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
  367. {
  368. ObjectiveInfo[BeingPlaced]=-1;
  369. format(string,sizeof(string),"~y~%s ~w~has died while ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName]);
  370. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  371. ObjectiveInfo[Count]=0;
  372. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  373. ObjectiveInfo[ProgressCount]=0;
  374. KillTimer(ObjectiveInfo[ProgressTimer]);
  375. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  376. }
  377. }
  378. CallRemoteFunction("UpdateAliveState","ii",playerid,0);
  379. return 1;
  380. }
  381.  
  382. public OnPlayerEnterCheckpoint(playerid)
  383. {
  384. if(!MissionStarted || ObjectivePlaced) return 1;
  385. new string[128];
  386. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced)
  387. {
  388. if(ObjectiveInfo[BeingPlaced] != -1)
  389. {
  390. format(string,sizeof(string),"%s is already trying to place the bomb. Please wait!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
  391. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  392. }
  393. else
  394. {
  395. ObjectiveInfo[BeingPlaced]=playerid;
  396. format(string,sizeof(string),"~y~%s~w~ is placing the bomb..!!",PlayerMissionInfo[playerid][UserName],playerid);
  397. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  398. format(string,sizeof(string),"Wait in the checkpoint for %d seconds to place the bomb.",PLACING_TIME);
  399. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  400. ObjectiveInfo[Count]=0;
  401. ObjectiveInfo[ProgressCount]=0;
  402. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  403. ObjectiveInfo[ObjectiveTimer] = SetTimer("PlacingTimer",1000,true);
  404. ObjectiveInfo[ProgressTimer] = SetTimer("ProgressFillUP",100,true);
  405. }
  406. }
  407. else
  408. {
  409. if(ObjectiveInfo[BeingPlaced] != -1)
  410. {
  411. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This is bomb placing sight, protect it.", 0);
  412. }
  413. else
  414. {
  415. format(string,sizeof(string),"%s is trying to place the bomb. Stop them!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
  416. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  417. }
  418. }
  419. return 1;
  420. }
  421.  
  422. public OnPlayerLeaveCheckpoint(playerid)
  423. {
  424. if(!MissionStarted || ObjectivePlaced) return 1;
  425. new string[128];
  426. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
  427. {
  428. ObjectiveInfo[BeingPlaced]=-1;
  429. format(string,sizeof(string),"~y~%s~w~ has left ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName],playerid);
  430. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  431. ObjectiveInfo[Count]=0;
  432. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  433. ObjectiveInfo[ProgressCount]=0;
  434. KillTimer(ObjectiveInfo[ProgressTimer]);
  435. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  436. }
  437. return 1;
  438. }
  439.  
  440. public OnVehicleSpawn(vehicleid)
  441. {
  442. SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
  443. return 1;
  444. }
  445.  
  446. FUNCTION EndTheMission()
  447. {
  448. if(!MissionStarted) return 1;
  449. MissionStarted= false;
  450. if(!MissionCancelled)
  451. {
  452. new string[256];
  453. new amount= 10000;
  454. if(!ObjectivePlaced)
  455. {
  456. amount+=Team[TEAM_DEFEND][Kills]*100;
  457. format(string,sizeof(string),""SERVER_KEY_MSG" %s has won the mission, by successfully defending the %s. Reward: $%d",Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName],amount);
  458. SendClientMessageToAll(COLOR_SERVER,string);
  459. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  460. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  461. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  462. {
  463. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  464. if(PlayerMissionInfo[i][TeamSelection] == TEAM_DEFEND)
  465. {
  466. PlayerPlaySound(i,3200,0,0,0);
  467. SendClientMessage(i,COLOR_TEAM_DEFEND,string);
  468. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  469. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  470. }
  471. if(PlayerMissionInfo[i][TeamSelection] != TEAM_DEFEND)
  472. {
  473. PlayerPlaySound(i,17004,0,0,0);
  474. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  475. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  476. }
  477. }
  478. }
  479. else
  480. {
  481. amount+=Team[TEAM_ATTACK][Kills]*100;
  482. format(string,sizeof(string),""SERVER_KEY_MSG" %s (%d) placed the bomb to destroy %s's %s. %s's has won the mission. Reward: 1 Token.",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName],ObjectiveInfo[BeingPlaced],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  483. SendClientMessageToAll(COLOR_SERVER,string);
  484. format(string,sizeof(string),""SERVER_KEY_MSG" %s have won the mission. Reward: $%d.",Team[TEAM_ATTACK][Name],amount);
  485. SendClientMessageToAll(COLOR_SERVER,string);
  486. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  487. CallRemoteFunction("PlayerMissionStats","dd",ObjectiveInfo[BeingPlaced],8);
  488. CallRemoteFunction("GivePlayerToken","dd",ObjectiveInfo[BeingPlaced],1);
  489. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the Team-Deathmatch!",amount);
  490. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  491. {
  492. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  493. if(PlayerMissionInfo[i][TeamSelection] == TEAM_ATTACK)
  494. {
  495. PlayerPlaySound(i,3200,0,0,0);
  496. SendClientMessage(i,COLOR_TEAM_ATTACK,string);
  497. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  498. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  499. }
  500. if(PlayerMissionInfo[i][TeamSelection] != TEAM_ATTACK)
  501. {
  502. PlayerPlaySound(i,17004,0,0,0);
  503. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  504. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  505. }
  506. }
  507. }
  508. }
  509. else
  510. {
  511. PlaySoundForAll(1058);
  512. SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
  513. CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
  514. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
  515. GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
  516. }
  517. return 1;
  518. }
  519.  
  520. //==============================================================================
  521. // Mission functions
  522. //==============================================================================
  523.  
  524. FUNCTION ProgressFillUP()
  525. {
  526. ObjectiveInfo[ProgressCount]++;
  527. CallRemoteFunction("UpdateBombProgressBar", "d", ObjectiveInfo[ProgressCount]);
  528. }
  529.  
  530. FUNCTION PlacingTimer()
  531. {
  532. if(!MissionStarted || ObjectivePlaced) return 1;
  533. if(ObjectiveInfo[BeingPlaced] == -1)
  534. {
  535. ObjectiveInfo[Count]=0;
  536. ObjectiveInfo[ProgressCount]=0;
  537. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  538. KillTimer(ObjectiveInfo[ProgressTimer]);
  539. }
  540. ObjectiveInfo[Count]++;
  541. if(ObjectiveInfo[Count] == PLACING_TIME)
  542. {
  543. ObjectivePlaced=true;
  544. new string[128],id=ObjectiveInfo[BeingPlaced];
  545. format(string,sizeof(string),""SERVER_KEY_MSG" %s (%d) has successfully planted the bomb, 15 seconds before the bomb explodes.",PlayerMissionInfo[id][UserName],id);
  546. SendClientMessageToAll(COLOR_SERVER,string);
  547. SetTimerEx("Explosion",15000,false,"ii",0,5);
  548. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  549. KillTimer(ObjectiveInfo[ProgressTimer]);
  550. FlashTimer= SetTimer("FlasBomb",500,true);
  551. CallRemoteFunction("FlashBombBar", "");
  552. CallRemoteFunction("UpdateBombInfo", "");
  553. CallRemoteFunction("KillGameModeTimer","");
  554. CallRemoteFunction("TD_Clock","s","_");
  555. DisableCheckpointForAll();
  556. }
  557. return 1;
  558. }
  559. FUNCTION FlasBomb()
  560. {
  561. CallRemoteFunction("FlashBombBar", "");
  562. return 1;
  563. }
  564.  
  565. FUNCTION Explosion(start, until)
  566. {
  567. for(new i = start; i < until; i++)
  568. {
  569. if(i >= MaxExplosions) break;
  570. CreateExplosion(ExplosionsInfo[i][0], ExplosionsInfo[i][1], ExplosionsInfo[i][2] , 7, 20.0);
  571. }
  572.  
  573. start += 5;
  574. until += 5;
  575.  
  576. if(until > MaxExplosions)
  577. {
  578. CallRemoteFunction("EndMission","");
  579. KillTimer(FlashTimer);
  580. }
  581. else
  582. {
  583. SetTimerEx("Explosion", 1000, false, "ii", start, until);
  584. }
  585. return 1;
  586. }
  587. DisableCheckpointForAll()
  588. {
  589. for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  590. {
  591. if(!IsPlayerConnected(i)) continue;
  592. DisablePlayerCheckpoint(i);
  593. }
  594. }
  595. PlaySoundForAll(sound)
  596. {
  597. for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  598. {
  599. if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
  600. }
  601. }
  602.  
  603. //==============================================================================
  604. // Important functions required
  605. //==============================================================================
  606.  
  607. FUNCTION OnPlayerNameRecieve(playerid,name[])
  608. {
  609. format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
  610. return 1;
  611. }
  612.  
  613. FUNCTION CancelTheMission()
  614. {
  615. MissionCancelled= true;
  616. return 1;
  617. }
  618.  
  619. FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
  620.  
  621. FUNCTION OnPlayerSpectateObjective(playerid)
  622. {
  623. SetPlayerCameraPos(playerid, CP_POS + 2.5);
  624. SetPlayerCameraLookAt(playerid, CP_POS);
  625. SetPlayerPos(playerid, CP_POS - 5);
  626.  
  627. SetPlayerColor(playerid, (PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) ? COLOR_TEAM_ATTACK_INV : COLOR_TEAM_DEFEND_INV);
  628. return 1;
  629. }
Advertisement
Add Comment
Please, Sign In to add comment