Bulletje

Untitled

Jan 24th, 2017
125
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 32.37 KB | None | 0 0
  1. /*
  2. Script by: Bullet
  3. Map by: Bullet
  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 "Morning Moon"
  23. #define Health 99.0
  24. #define OBJ_NAME "Drug Ship"
  25. #define CP_POS 1807.3480,-4986.7026,6.6110
  26. #define CP_SIZE 3.0
  27. #define VEHICLE_HEALTH 999.0
  28. #define CLASS_POSTION 3734.8755,-2448.6968,17.5937
  29. #define CLASS_CAMERA 3734.9092,-2446.4177,16.7819
  30. #define CLASS_FACING_AGNLE 358.6529
  31. #define TEAM_DEFEND_NAME "Da Nang Boy"
  32. #define TEAM_ATTACK_NAME "Detective"
  33. #define MAX_MAP_OBJECTS 117
  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,165,1977.8362,-2321.5566,13.5469,178.9659,0,0,WEAPON_SILENCED,100,WEAPON_SHOTGSPA,100,WEAPON_M4,120},
  61. {TEAM_DEFEND,122, 1775.9105,-4119.2178,12.5696,270.8882,0,0,WEAPON_COLT45,280,WEAPON_AK47,160,WEAPON_BAT,120},
  62. {TEAM_ATTACK,165,1977.8362,-2321.5566,13.5469,178.9659,0,0,WEAPON_DEAGLE,100,WEAPON_SHOTGUN,100,WEAPON_MP5,120},
  63. {TEAM_DEFEND,123, 1775.9105,-4119.2178,12.5696,270.8882,0,0,WEAPON_SHOTGUN,280,WEAPON_MP5,160,WEAPON_CHAINSAW,1}
  64. };
  65.  
  66. new const Float:ExplosionsInfo[][3] = {
  67. {1850.4011,-4121.1997,5.9978},
  68. {1835.4907,-4125.2900,5.9978},
  69. {1841.0261,-4114.0918,5.9978},
  70. {1824.5320,-4114.0830,5.9978},
  71. {1817.8973,-4120.7837,5.9978},
  72. {1813.0046,-4128.0088,5.9978}
  73.  
  74. };
  75.  
  76. #if MAX_MAP_OBJECTS != 0
  77. new Object[MAX_MAP_OBJECTS];
  78.  
  79. CreateMap()
  80. {
  81. Object[0] = CreateObject(10230,1822.6368400,-4118.6630900,11.2804900,0.0000000,0.0000200,0.0000000); //
  82. Object[1] = CreateObject(10140,1837.2597700,-4119.6962900,11.2556000,0.0000000,0.0000200,0.0000000); //
  83. Object[2] = CreateObject(10227,1867.4239500,-4118.9018600,16.0262000,0.0000000,0.0000200,0.0000000); //
  84. Object[3] = CreateObject(10226,1866.9346900,-4117.8920900,9.6922000,0.0000000,0.0000200,0.0000000); //
  85. Object[4] = CreateObject(10231,1821.7042200,-4120.1377000,12.6305000,0.0000000,0.0000200,0.0000000); //
  86. Object[5] = CreateObject(4844,1735.5454100,-4079.2934600,-6.0641000,0.0000000,-0.0000200,179.9998600); //
  87. Object[6] = CreateObject(4844,1727.2457300,-4055.1899400,-6.0641000,0.0000000,-0.0000200,179.9998600); //
  88. Object[7] = CreateObject(10229,1822.3790300,-4120.1215800,9.9056000,0.0000000,0.0000200,0.0000000); //
  89. Object[8] = CreateObject(4844,1733.4527600,-4105.1586900,-5.9308300,0.0000000,-0.0000200,179.9998600); //
  90. Object[9] = CreateObject(17026,1830.1739500,-4158.2280300,3.2714200,0.0000200,0.0000100,48.4800000); //
  91. Object[10] = CreateObject(17026,1867.1903100,-4158.9340800,3.2706700,0.0000200,0.0000100,48.4800000); //
  92. Object[11] = CreateObject(17026,1905.5865500,-4156.7109400,3.2706700,0.0000200,0.0000100,48.4800000); //
  93. Object[12] = CreateObject(17026,1920.5036600,-4139.0185500,3.2706700,0.0000200,0.0000000,99.8999200); //
  94. Object[13] = CreateObject(17026,1925.6842000,-4114.0996100,3.2706700,0.0000100,-0.0000200,147.5399800); //
  95. Object[14] = CreateObject(17026,1801.1843300,-4159.6225600,3.2706700,0.0000200,0.0000100,48.4800000); //
  96. Object[15] = CreateObject(17026,1773.2297400,-4155.7705100,3.2706700,0.0000200,0.0000100,48.4800000); //
  97. Object[16] = CreateObject(971,1761.5500500,-4155.9907200,22.0112400,0.0000000,0.0000200,0.0000000); //
  98. Object[17] = CreateObject(971,1761.5500500,-4155.9907200,28.9964000,0.0000000,0.0000200,0.0000000); //
  99. Object[18] = CreateObject(971,1770.3439900,-4156.0151400,22.0112400,0.0000000,0.0000200,0.0000000); //
  100. Object[19] = CreateObject(971,1767.3122600,-4155.9599600,14.8597000,0.0000000,0.0000200,0.0000000); //
  101. Object[20] = CreateObject(971,1770.2888200,-4156.0459000,28.9964000,0.0000000,0.0000200,0.0000000); //
  102. Object[21] = CreateObject(971,1779.0484600,-4155.9751000,28.9964000,0.0000000,0.0000200,0.0000000); //
  103. Object[22] = CreateObject(971,1779.0484600,-4155.9751000,21.8333700,0.0000000,0.0000200,0.0000000); //
  104. Object[23] = CreateObject(971,1787.7458500,-4156.0268600,21.9248700,0.0000000,0.0000200,0.0000000); //
  105. Object[24] = CreateObject(971,1787.8023700,-4155.9834000,28.9964000,0.0000000,0.0000200,0.0000000); //
  106. Object[25] = CreateObject(971,1796.5284400,-4155.9550800,28.9964000,0.0000000,0.0000200,0.0000000); //
  107. Object[26] = CreateObject(971,1796.5284400,-4155.9550800,21.9014000,0.0000000,0.0000200,0.0000000); //
  108. Object[27] = CreateObject(971,1805.2866200,-4155.9960900,21.9014000,0.0000000,0.0000200,0.0000000); //
  109. Object[28] = CreateObject(971,1805.3292200,-4155.9824200,28.9964000,0.0000000,0.0000200,0.0000000); //
  110. Object[29] = CreateObject(971,1814.0113500,-4156.0302700,21.9014000,0.0000000,0.0000200,0.0000000); //
  111. Object[30] = CreateObject(971,1814.0731200,-4156.0195300,28.9964000,0.0000000,0.0000200,0.0000000); //
  112. Object[31] = CreateObject(971,1822.7318100,-4156.0615200,21.9014000,0.0000000,0.0000200,0.0000000); //
  113. Object[32] = CreateObject(971,1822.7347400,-4156.0434600,28.9964000,0.0000000,0.0000200,0.0000000); //
  114. Object[33] = CreateObject(971,1831.4506800,-4156.0449200,21.9014000,0.0000000,0.0000200,0.0000000); //
  115. Object[34] = CreateObject(971,1831.4816900,-4156.0600600,28.9964000,0.0000000,0.0000200,0.0000000); //
  116. Object[35] = CreateObject(971,1840.2039800,-4156.0493200,21.9014000,0.0000000,0.0000200,0.0000000); //
  117. Object[36] = CreateObject(971,1840.2729500,-4156.0835000,28.9964000,0.0000000,0.0000200,0.0000000); //
  118. Object[37] = CreateObject(971,1848.9919400,-4156.0839800,21.9014000,0.0000000,0.0000200,0.0000000); //
  119. Object[38] = CreateObject(971,1849.1051000,-4156.1049800,28.9964000,0.0000000,0.0000200,0.0000000); //
  120. Object[39] = CreateObject(971,1857.7915000,-4156.0659200,21.8774800,0.0000000,0.0000200,0.0000000); //
  121. Object[40] = CreateObject(971,1857.8710900,-4156.1113300,28.9964000,0.0000000,0.0000200,0.0000000); //
  122. Object[41] = CreateObject(971,1857.7915000,-4156.0659200,14.7372000,0.0000000,0.0000200,0.0000000); //
  123. Object[42] = CreateObject(971,1866.5676300,-4156.0600600,21.8774800,0.0000000,0.0000200,0.0000000); //
  124. Object[43] = CreateObject(971,1866.5658000,-4156.0859400,28.9964000,0.0000000,0.0000200,0.0000000); //
  125. Object[44] = CreateObject(971,1875.2989500,-4156.0883800,21.8774800,0.0000000,0.0000200,0.0000000); //
  126. Object[45] = CreateObject(971,1875.2823500,-4156.0610400,28.9964000,0.0000000,0.0000200,0.0000000); //
  127. Object[46] = CreateObject(971,1884.0333300,-4156.1386700,21.8774800,0.0000000,0.0000200,0.0000000); //
  128. Object[47] = CreateObject(971,1884.0245400,-4156.1416000,28.9964000,0.0000000,0.0000200,0.0000000); //
  129. Object[48] = CreateObject(17026,1742.3210400,-4140.3208000,3.2706700,0.0000000,0.0000200,15.0600000); //
  130. Object[49] = CreateObject(17026,1729.1583300,-4118.2500000,3.2706700,-0.0000100,0.0000200,-23.8799900); //
  131. Object[50] = CreateObject(971,1754.0012200,-4152.9531300,22.0112400,-0.0000100,0.0000200,-39.6000000); //
  132. Object[51] = CreateObject(971,1747.3022500,-4147.3007800,22.0112400,-0.0000100,0.0000200,-39.6000000); //
  133. Object[52] = CreateObject(971,1754.0012200,-4152.9531300,29.1171200,-0.0000100,0.0000200,-39.6000000); //
  134. Object[53] = CreateObject(971,1747.3022500,-4147.3007800,29.1171200,-0.0000100,0.0000200,-39.6000000); //
  135. Object[54] = CreateObject(971,1740.4882800,-4141.7231400,22.0112400,-0.0000100,0.0000200,-39.6000000); //
  136. Object[55] = CreateObject(971,1740.5061000,-4141.7172900,29.1171200,-0.0000100,0.0000200,-39.6000000); //
  137. Object[56] = CreateObject(971,1736.8774400,-4134.4536100,22.0112400,-0.0000200,0.0000000,-85.6199300); //
  138. Object[57] = CreateObject(971,1736.8774400,-4134.4536100,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  139. Object[58] = CreateObject(971,1736.1894500,-4125.6240200,22.0112400,-0.0000200,0.0000000,-85.6199300); //
  140. Object[59] = CreateObject(971,1736.1777300,-4125.6572300,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  141. Object[60] = CreateObject(971,1736.1894500,-4125.6240200,14.9027500,-0.0000200,0.0000000,-85.6199300); //
  142. Object[61] = CreateObject(971,1735.1104700,-4117.1181600,22.0112400,-0.0000200,0.0000000,-85.6199300); //
  143. Object[62] = CreateObject(971,1735.0953400,-4117.0922900,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  144. Object[63] = CreateObject(971,1734.4399400,-4108.3237300,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  145. Object[64] = CreateObject(971,1734.4399400,-4108.3237300,22.0432400,-0.0000200,0.0000000,-85.6199300); //
  146. Object[65] = CreateObject(971,1734.4399400,-4108.3237300,14.9820600,-0.0000200,0.0000000,-85.6199300); //
  147. Object[66] = CreateObject(971,1735.1866500,-4117.0190400,14.9820600,-0.0000200,0.0000000,-85.6199300); //
  148. Object[67] = CreateObject(17026,1728.1269500,-4091.4331100,3.2706700,-0.0000100,0.0000200,-23.8799900); //
  149. Object[68] = CreateObject(971,1733.6923800,-4099.5742200,22.0432400,-0.0000200,0.0000000,-85.6199300); //
  150. Object[69] = CreateObject(971,1733.6923800,-4099.5742200,14.9232600,-0.0000200,0.0000000,-85.6199300); //
  151. Object[70] = CreateObject(971,1733.7102100,-4099.5625000,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  152. Object[71] = CreateObject(971,1733.0371100,-4090.7973600,22.0432400,-0.0000200,0.0000000,-85.6199300); //
  153. Object[72] = CreateObject(971,1733.0354000,-4090.8398400,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  154. Object[73] = CreateObject(971,1892.2763700,-4154.1152300,28.9964000,0.0000100,0.0000200,27.8399900); //
  155. Object[74] = CreateObject(971,1892.3581500,-4154.1743200,21.8774800,0.0000100,0.0000200,28.5599700); //
  156. Object[75] = CreateObject(971,1897.0782500,-4151.6328100,14.7974200,0.0000100,0.0000200,28.5599700); //
  157. Object[76] = CreateObject(971,1904.7579300,-4147.4716800,14.7974200,0.0000100,0.0000200,28.5599700); //
  158. Object[77] = CreateObject(971,1900.0942400,-4150.0092800,21.8774800,0.0000100,0.0000200,28.5599700); //
  159. Object[78] = CreateObject(971,1907.7996800,-4145.8408200,21.8774800,0.0000100,0.0000200,28.5599700); //
  160. Object[79] = CreateObject(971,1899.9751000,-4150.0595700,28.9964000,0.0000100,0.0000200,27.8399900); //
  161. Object[80] = CreateObject(971,1907.6899400,-4145.8691400,28.9964000,0.0000100,0.0000200,27.8399900); //
  162. Object[81] = CreateObject(971,1911.6561300,-4142.2563500,14.7974200,0.0000200,0.0000100,46.6800000); //
  163. Object[82] = CreateObject(971,1911.6213400,-4142.4277300,21.8774800,0.0000200,0.0000100,46.6199600); //
  164. Object[83] = CreateObject(971,1911.6320800,-4142.3989300,28.9964000,0.0000200,0.0000100,46.4999800); //
  165. Object[84] = CreateObject(971,1917.6436800,-4136.0151400,28.9964000,0.0000200,0.0000100,46.4999800); //
  166. Object[85] = CreateObject(971,1917.6344000,-4135.9975600,21.9049800,0.0000200,0.0000100,46.4999800); //
  167. Object[86] = CreateObject(971,1923.6732200,-4129.6577100,21.8909200,0.0000200,0.0000100,46.4999800); //
  168. Object[87] = CreateObject(971,1923.6995800,-4129.6313500,28.9964000,0.0000200,0.0000100,46.4999800); //
  169. Object[88] = CreateObject(971,1929.7309600,-4123.3183600,21.8909200,0.0000200,0.0000100,46.4999800); //
  170. Object[89] = CreateObject(971,1929.7177700,-4123.3413100,28.9964000,0.0000200,0.0000100,46.4999800); //
  171. Object[90] = CreateObject(971,1928.9777800,-4119.5966800,21.8909200,0.0000200,0.0000000,103.0199300); //
  172. Object[91] = CreateObject(971,1928.9777800,-4119.5966800,28.9816100,0.0000200,0.0000000,103.0199300); //
  173. Object[92] = CreateObject(971,1927.0223400,-4111.1337900,21.8646200,0.0000200,0.0000000,103.0199300); //
  174. Object[93] = CreateObject(971,1927.0223400,-4111.1337900,28.9416400,0.0000200,0.0000000,103.0199300); //
  175. Object[94] = CreateObject(971,1925.1020500,-4102.5942400,21.8646200,0.0000200,0.0000000,103.0199300); //
  176. Object[95] = CreateObject(971,1925.0845900,-4102.5957000,28.9416400,0.0000200,0.0000000,103.0199300); //
  177. Object[96] = CreateObject(971,1923.1137700,-4094.0776400,21.8646200,0.0000200,0.0000000,103.0199300); //
  178. Object[97] = CreateObject(971,1923.0925300,-4094.0415000,28.9416400,0.0000200,0.0000000,103.0199300); //
  179. Object[98] = CreateObject(17026,1926.4926800,-4083.1157200,3.2706700,0.0000100,-0.0000200,147.5399800); //
  180. Object[99] = CreateObject(971,1921.1451400,-4085.5200200,21.8646200,0.0000200,0.0000000,103.0199300); //
  181. Object[100] = CreateObject(971,1921.1451400,-4085.5200200,28.9844500,0.0000200,0.0000000,103.0199300); //
  182. Object[101] = CreateObject(971,1919.1778600,-4076.9619100,21.8646200,0.0000200,0.0000000,103.0199300); //
  183. Object[102] = CreateObject(971,1919.1778600,-4076.9619100,28.9631800,0.0000200,0.0000000,103.0199300); //
  184. Object[103] = CreateObject(971,1919.1778600,-4076.9619100,14.7393800,0.0000200,0.0000000,103.0199300); //
  185. Object[104] = CreateObject(971,1917.1400100,-4068.3466800,14.7393800,0.0000200,0.0000000,103.0199300); //
  186. Object[105] = CreateObject(971,1917.1385500,-4068.3266600,21.8202100,0.0000200,0.0000000,103.0199300); //
  187. Object[106] = CreateObject(971,1917.1385500,-4068.3266600,28.9608700,0.0000200,0.0000000,103.0199300); //
  188. Object[107] = CreateObject(17026,1744.7255900,-4137.1787100,3.2706700,0.0000000,0.0000200,15.0600000); //
  189. Object[108] = CreateObject(17026,1748.5588400,-4100.3823200,3.2706700,0.0000100,-0.0000200,147.5399800); //
  190. Object[109] = CreateObject(3864,1765.2844200,-4100.0634800,10.7350100,0.0000000,0.0000200,0.0000000); //
  191. Object[110] = CreateObject(971,1732.4278600,-4082.0239300,22.0432400,-0.0000200,0.0000000,-85.6199300); //
  192. Object[111] = CreateObject(971,1732.4278600,-4082.0239300,15.0455000,-0.0000200,0.0000000,-85.6199300); //
  193. Object[112] = CreateObject(971,1732.4552000,-4082.0786100,29.1158100,-0.0000200,0.0000000,-85.6199300); //
  194. Object[113] = CreateObject(5006,1840.7668500,-2267.9177200,-0.1110700,356.8584000,20.0000000,84.6816000); //
  195. Object[114] = CreateObject(5006,1836.7730700,-2304.4174800,4.6801300,356.8584000,20.0000000,-87.7583800); //
  196. Object[115] = CreateObject(4844,1736.4711900,-4084.2929700,-5.9257400,0.0000000,-0.0000200,179.9998600); //
  197. Object[116] = CreateObject(4844,1735.4587400,-4068.2731900,-6.0544300,0.0000000,-0.0000200,179.9998600); //
  198.  
  199. AddStaticVehicleEx(476,1949.4368000,-2457.6289000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  200. AddStaticVehicleEx(476,1915.5701000,-2457.0522000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  201. AddStaticVehicleEx(476,1915.5084000,-2438.8694000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  202. AddStaticVehicleEx(476,1949.1677000,-2439.6377000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  203. AddStaticVehicleEx(476,1915.3103000,-2422.0898000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  204. AddStaticVehicleEx(476,1949.3010000,-2422.4353000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  205. AddStaticVehicleEx(476,1915.4602000,-2403.0129000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  206. AddStaticVehicleEx(476,1949.3527000,-2402.5029000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  207. AddStaticVehicleEx(476,1915.2415000,-2384.9609000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  208. AddStaticVehicleEx(476,1949.9720000,-2384.3511000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  209. AddStaticVehicleEx(476,1948.7296000,-2364.6409000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  210. AddStaticVehicleEx(476,1914.1863000,-2362.9084000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  211. AddStaticVehicleEx(476,1914.2129000,-2343.4299000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  212. AddStaticVehicleEx(476,1948.7542000,-2344.1282000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  213. AddStaticVehicleEx(476,1949.5358000,-2320.9905000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  214. AddStaticVehicleEx(476,1914.7389000,-2320.9790000,14.5977000,-179.8200000,-1,-1,15); //Rustler
  215. AddStaticVehicleEx(447,1874.2543000,-2328.6741000,24.6659000,-186.4200000,-1,-1,15); //Seasparrow
  216. AddStaticVehicleEx(447,1874.9183000,-2245.8132000,24.6659000,-186.4200000,-1,-1,15); //Seasparrow
  217. AddStaticVehicleEx(407,1846.3180000,-4133.6885000,6.1183000,-90.0000000,-1,-1,15); //Firetruck
  218.  
  219. }
  220. #endif
  221.  
  222.  
  223. //==============================================================================
  224. // Basic vars
  225. //==============================================================================
  226.  
  227. new bool:MissionStarted;
  228. new bool:ObjectiveStarted;
  229. new bool:MissionCancelled;
  230.  
  231. new bool:ObjectivePlaced;
  232.  
  233. native IsValidVehicle(vehicleid);
  234.  
  235. enum obj
  236. {
  237. ObjectiveName[30],
  238. BeingPlaced,
  239. ObjectiveTimer,
  240. ProgressTimer,
  241. ProgressCount,
  242. Count
  243. };
  244.  
  245. enum teamdata
  246. {
  247. Name[32],
  248. Members,
  249. Kills
  250. };
  251.  
  252. enum playerdata
  253. {
  254. UserName[MAX_PLAYER_NAME],
  255. bool:TeamChosen,
  256. TeamSelection,
  257. PlayerClassID
  258. };
  259.  
  260. new Team[2][teamdata];
  261. new PlayerMissionInfo[MAX_PLAYERS][playerdata];
  262. new ObjectiveInfo[obj];
  263.  
  264. new MaxExplosions;
  265. new FlashTimer;
  266.  
  267. //==============================================================================
  268. // Basic script
  269. //==============================================================================
  270.  
  271. main()
  272. {
  273. print("----------------------------------");
  274. print(" Mission: "MISSION_NAME" started.");
  275. print("----------------------------------\n");
  276. }
  277.  
  278. public OnGameModeInit()
  279. {
  280. MissionStarted= true;
  281. format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
  282. format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
  283.  
  284. format(ObjectiveInfo[ObjectiveName],sizeof(ObjectiveInfo[ObjectiveName]),"%s",OBJ_NAME);
  285.  
  286. CallRemoteFunction("CreateBombingTD","d",PLACING_TIME*10);
  287.  
  288. MaxExplosions= sizeof(ExplosionsInfo);
  289. ObjectivePlaced= false;
  290. ObjectiveInfo[BeingPlaced]=-1;
  291.  
  292. #if MAX_MAP_OBJECTS != 0
  293. CreateMap();
  294. #endif
  295.  
  296. for(new i=0; i<sizeof(SkinData); i++)
  297. {
  298. 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);
  299. }
  300.  
  301. for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
  302.  
  303. for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
  304.  
  305. if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
  306. SetTimer("StartMissionFunc",3000,false);
  307. return 1;
  308. }
  309.  
  310. FUNCTION StartMissionFunc()
  311. {
  312. CallRemoteFunction("StartMission","");
  313. ObjectiveStarted= true;
  314. return 1;
  315. }
  316.  
  317. public OnGameModeExit()
  318. {
  319. #if MAX_MAP_OBJECTS != 0
  320. for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
  321. #endif
  322. for(new i=0; i<MAX_VEHICLES; i++)
  323. {
  324. DestroyVehicle(i);
  325. }
  326. return 1;
  327. }
  328.  
  329. public OnPlayerDisconnect(playerid)
  330. {
  331. if(PlayerMissionInfo[playerid][TeamChosen])
  332. {
  333. Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
  334. PlayerMissionInfo[playerid][TeamChosen]=false;
  335. }
  336. return 1;
  337. }
  338.  
  339. public OnPlayerRequestClass(playerid,classid)
  340. {
  341. SetPlayerPos(playerid,CLASS_POSTION);
  342. SetPlayerCameraPos(playerid,CLASS_CAMERA);
  343. SetPlayerCameraLookAt(playerid,CLASS_POSTION);
  344. SetPlayerFacingAngle(playerid,CLASS_FACING_AGNLE);
  345.  
  346. CallRemoteFunction("ShowClassSelection","iisiii",playerid, SkinData[classid][TeamID],Team[SkinData[classid][TeamID]][Name], SkinData[classid][Weapon1], SkinData[classid][Weapon2], SkinData[classid][Weapon3]);
  347.  
  348. if(PlayerMissionInfo[playerid][TeamChosen])
  349. {
  350. PlayerMissionInfo[playerid][TeamChosen] = false;
  351. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
  352. }
  353.  
  354. PlayerMissionInfo[playerid][TeamSelection] = SkinData[classid][TeamID];
  355. PlayerMissionInfo[playerid][PlayerClassID]=classid;
  356. return 1;
  357. }
  358.  
  359. public OnPlayerRequestSpawn(playerid)
  360. {
  361. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  362. if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
  363. {
  364. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This Team is full, choose another!",0);
  365. return 0;
  366. }
  367. return 1;
  368. }
  369.  
  370.  
  371. public OnPlayerSpawn(playerid)
  372. {
  373. new string[124];
  374. CallRemoteFunction("UpdateAliveState","ii",playerid,1);
  375. if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
  376. if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
  377. else
  378. {
  379. SetPlayerPos(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
  380. SetPlayerInterior(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
  381. SetPlayerFacingAngle(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
  382. SetPlayerVirtualWorld(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
  383. if(!PlayerMissionInfo[playerid][TeamChosen])
  384. {
  385. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
  386. PlayerMissionInfo[playerid][TeamChosen] = true;
  387. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  388. {
  389. format(string,sizeof(string),"You are a %s, your mission is to destroy the %s.",Team[TEAM_ATTACK][Name],ObjectiveInfo[ObjectiveName]);
  390. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  391. format(string,sizeof(string),"%s will try to stop you, eliminate them!.",Team[TEAM_DEFEND][Name]);
  392. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string,4000);
  393. format(string,sizeof(string),"Destroy the ~y~%s~w~!",ObjectiveInfo[ObjectiveName]);
  394. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  395. }
  396. else
  397. {
  398. 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]);
  399. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  400. format(string,sizeof(string),"Protect the ~y~%s~w~!.",ObjectiveInfo[ObjectiveName]);
  401. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  402. }
  403. }
  404. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
  405. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
  406. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
  407. }
  408. SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
  409. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
  410. else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
  411.  
  412. SetPlayerHealth(playerid,Health);
  413. #if SPAWN_PROTECTION == true
  414. CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
  415. #endif
  416.  
  417. CallRemoteFunction("OnPlayerBombingData", "ii", playerid, 1);
  418.  
  419. SetPlayerCheckpoint(playerid,CP_POS,CP_SIZE);
  420. return 1;
  421. }
  422.  
  423. public OnPlayerDeath(playerid, killerid, reason)
  424. {
  425. new string[128];
  426. if(killerid != INVALID_PLAYER_ID)
  427. {
  428. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  429. Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
  430. }
  431. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  432. {
  433. if(!ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
  434. {
  435. ObjectiveInfo[BeingPlaced]=-1;
  436. format(string,sizeof(string),"~y~%s ~w~has died while ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName]);
  437. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  438. ObjectiveInfo[Count]=0;
  439. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  440. ObjectiveInfo[ProgressCount]=0;
  441. KillTimer(ObjectiveInfo[ProgressTimer]);
  442. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  443. }
  444. }
  445. CallRemoteFunction("UpdateAliveState","ii",playerid,0);
  446. return 1;
  447. }
  448.  
  449. public OnPlayerEnterCheckpoint(playerid)
  450. {
  451. if(!MissionStarted || ObjectivePlaced) return 1;
  452. new string[128];
  453. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced)
  454. {
  455. if(ObjectiveInfo[BeingPlaced] != -1)
  456. {
  457. format(string,sizeof(string),"%s is already trying to place the bomb. Please wait!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
  458. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  459. }
  460. else
  461. {
  462. ObjectiveInfo[BeingPlaced]=playerid;
  463. format(string,sizeof(string),"~y~%s~w~ is placing the bomb..!!",PlayerMissionInfo[playerid][UserName],playerid);
  464. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  465. format(string,sizeof(string),"Wait in the checkpoint for %d seconds to place the bomb.",PLACING_TIME);
  466. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  467. ObjectiveInfo[Count]=0;
  468. ObjectiveInfo[ProgressCount]=0;
  469. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  470. ObjectiveInfo[ObjectiveTimer] = SetTimer("PlacingTimer",1000,true);
  471. ObjectiveInfo[ProgressTimer] = SetTimer("ProgressFillUP",100,true);
  472. }
  473. }
  474. else
  475. {
  476. if(ObjectiveInfo[BeingPlaced] != -1)
  477. {
  478. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This is bomb placing sight, protect it.", 0);
  479. }
  480. else
  481. {
  482. format(string,sizeof(string),"%s is trying to place the bomb. Stop them!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
  483. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  484. }
  485. }
  486. return 1;
  487. }
  488.  
  489. public OnPlayerLeaveCheckpoint(playerid)
  490. {
  491. if(!MissionStarted || ObjectivePlaced) return 1;
  492. new string[128];
  493. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
  494. {
  495. ObjectiveInfo[BeingPlaced]=-1;
  496. format(string,sizeof(string),"~y~%s~w~ has left ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName],playerid);
  497. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  498. ObjectiveInfo[Count]=0;
  499. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  500. ObjectiveInfo[ProgressCount]=0;
  501. KillTimer(ObjectiveInfo[ProgressTimer]);
  502. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  503. }
  504. return 1;
  505. }
  506.  
  507. public OnVehicleSpawn(vehicleid)
  508. {
  509. SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
  510. return 1;
  511. }
  512.  
  513. FUNCTION EndTheMission()
  514. {
  515. if(!MissionStarted) return 1;
  516. MissionStarted= false;
  517. if(!MissionCancelled)
  518. {
  519. new string[256];
  520. new amount= 10000;
  521. if(!ObjectivePlaced)
  522. {
  523. amount+=Team[TEAM_DEFEND][Kills]*100;
  524. 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);
  525. SendClientMessageToAll(COLOR_SERVER,string);
  526. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  527. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  528. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  529. {
  530. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  531. if(PlayerMissionInfo[i][TeamSelection] == TEAM_DEFEND)
  532. {
  533. PlayerPlaySound(i,3200,0,0,0);
  534. SendClientMessage(i,COLOR_TEAM_DEFEND,string);
  535. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  536. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  537. }
  538. if(PlayerMissionInfo[i][TeamSelection] != TEAM_DEFEND)
  539. {
  540. PlayerPlaySound(i,17004,0,0,0);
  541. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  542. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  543. }
  544. }
  545. }
  546. else
  547. {
  548. amount+=Team[TEAM_ATTACK][Kills]*100;
  549. 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]);
  550. SendClientMessageToAll(COLOR_SERVER,string);
  551. format(string,sizeof(string),""SERVER_KEY_MSG" %s have won the mission. Reward: $%d.",Team[TEAM_ATTACK][Name],amount);
  552. SendClientMessageToAll(COLOR_SERVER,string);
  553. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  554. CallRemoteFunction("PlayerMissionStats","dd",ObjectiveInfo[BeingPlaced],8);
  555. CallRemoteFunction("GivePlayerToken","dd",ObjectiveInfo[BeingPlaced],1);
  556. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the Team-Deathmatch!",amount);
  557. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  558. {
  559. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  560. if(PlayerMissionInfo[i][TeamSelection] == TEAM_ATTACK)
  561. {
  562. PlayerPlaySound(i,3200,0,0,0);
  563. SendClientMessage(i,COLOR_TEAM_ATTACK,string);
  564. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  565. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  566. }
  567. if(PlayerMissionInfo[i][TeamSelection] != TEAM_ATTACK)
  568. {
  569. PlayerPlaySound(i,17004,0,0,0);
  570. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  571. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  572. }
  573. }
  574. }
  575. }
  576. else
  577. {
  578. PlaySoundForAll(1058);
  579. SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
  580. CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
  581. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
  582. GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
  583. }
  584. return 1;
  585. }
  586.  
  587. //==============================================================================
  588. // Mission functions
  589. //==============================================================================
  590.  
  591. FUNCTION ProgressFillUP()
  592. {
  593. ObjectiveInfo[ProgressCount]++;
  594. CallRemoteFunction("UpdateBombProgressBar", "d", ObjectiveInfo[ProgressCount]);
  595. }
  596.  
  597. FUNCTION PlacingTimer()
  598. {
  599. if(!MissionStarted || ObjectivePlaced) return 1;
  600. if(ObjectiveInfo[BeingPlaced] == -1)
  601. {
  602. ObjectiveInfo[Count]=0;
  603. ObjectiveInfo[ProgressCount]=0;
  604. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  605. KillTimer(ObjectiveInfo[ProgressTimer]);
  606. }
  607. ObjectiveInfo[Count]++;
  608. if(ObjectiveInfo[Count] == PLACING_TIME)
  609. {
  610. ObjectivePlaced=true;
  611. new string[128],id=ObjectiveInfo[BeingPlaced];
  612. format(string,sizeof(string),""SERVER_KEY_MSG" %s (%d) has successfully planted the bomb, 15 seconds before the bomb explodes.",PlayerMissionInfo[id][UserName],id);
  613. SendClientMessageToAll(COLOR_SERVER,string);
  614. SetTimerEx("Explosion",15000,false,"ii",0,5);
  615. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  616. KillTimer(ObjectiveInfo[ProgressTimer]);
  617. FlashTimer= SetTimer("FlasBomb",500,true);
  618. CallRemoteFunction("FlashBombBar", "");
  619. CallRemoteFunction("UpdateBombInfo", "");
  620. CallRemoteFunction("KillGameModeTimer","");
  621. CallRemoteFunction("TD_Clock","s","_");
  622. DisableCheckpointForAll();
  623. }
  624. return 1;
  625. }
  626. FUNCTION FlasBomb()
  627. {
  628. CallRemoteFunction("FlashBombBar", "");
  629. return 1;
  630. }
  631.  
  632. FUNCTION Explosion(start, until)
  633. {
  634. for(new i = start; i < until; i++)
  635. {
  636. if(i >= MaxExplosions) break;
  637. CreateExplosion(ExplosionsInfo[i][0], ExplosionsInfo[i][1], ExplosionsInfo[i][2] , 7, 20.0);
  638. }
  639.  
  640. start += 5;
  641. until += 5;
  642.  
  643. if(until > MaxExplosions)
  644. {
  645. CallRemoteFunction("EndMission","");
  646. KillTimer(FlashTimer);
  647. }
  648. else
  649. {
  650. SetTimerEx("Explosion", 1000, false, "ii", start, until);
  651. }
  652. return 1;
  653. }
  654. DisableCheckpointForAll()
  655. {
  656. for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  657. {
  658. if(!IsPlayerConnected(i)) continue;
  659. DisablePlayerCheckpoint(i);
  660. }
  661. }
  662. PlaySoundForAll(sound)
  663. {
  664. for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  665. {
  666. if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
  667. }
  668. }
  669.  
  670. //==============================================================================
  671. // Important functions required
  672. //==============================================================================
  673.  
  674. FUNCTION OnPlayerNameRecieve(playerid,name[])
  675. {
  676. format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
  677. return 1;
  678. }
  679.  
  680. FUNCTION CancelTheMission()
  681. {
  682. MissionCancelled= true;
  683. return 1;
  684. }
  685.  
  686. FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
  687.  
  688. FUNCTION OnPlayerSpectateObjective(playerid)
  689. {
  690. SetPlayerCameraPos(playerid, CP_POS + 2.5);
  691. SetPlayerCameraLookAt(playerid, CP_POS);
  692. SetPlayerPos(playerid, CP_POS - 5);
  693.  
  694. SetPlayerColor(playerid, (PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) ? COLOR_TEAM_ATTACK_INV : COLOR_TEAM_DEFEND_INV);
  695. return 1;
  696. }
Advertisement
Add Comment
Please, Sign In to add comment