Bulletje

Untitled

Feb 19th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 22.14 KB | None | 0 0
  1. /*
  2. Script by: Sasuke_Uchiha
  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 "Zombotech Breakout"
  23. #define Health 99.0
  24. #define OBJ_NAME "Analysis Lab"
  25. #define CP_POS -1921.3180,643.8784,46.5625
  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 "Scientists"
  32. #define TEAM_ATTACK_NAME "Hippies"
  33. #define MAX_MAP_OBJECTS 23
  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,72,-1706.9100,1018.2330,17.5859,265.7611,0,0,WEAPON_DEAGLE,100,WEAPON_SHOTGUN,100,WEAPON_MP5,120},
  61. {TEAM_DEFEND,70, -1973.8809,640.2412,46.5625,358.0914,0,0,WEAPON_DEAGLE,100,WEAPON_SHOTGUN,100,WEAPON_MP5,120},
  62. {TEAM_ATTACK,73,-1716.0190,1018.3843,17.5859,89.9794,0,0,WEAPON_COLT45,280,WEAPON_SHOTGSPA,160,WEAPON_AK47,120},
  63. {TEAM_DEFEND,290, -1985.9628,660.1379,46.5683,266.8450,0,0,WEAPON_COLT45,280,WEAPON_SHOTGSPA,160,WEAPON_AK47,120}
  64. };
  65.  
  66. new const Float:ExplosionsInfo[][3] = {
  67. {-1960.4420,685.3842,50.5625},
  68. {-1956.4834,644.5552,50.5625},
  69. {-1920.3893,644.8896,46.5625},
  70. {-1922.2981,679.2878,46.5625},
  71. {-1951.9568,651.3607,47.7031},
  72. {-1983.3198,650.9373,46.5683},
  73. {-1952.7455,685.1750,46.5625},
  74. {-1930.7869,685.9023,46.5625},
  75. {-1971.1843,695.2595,46.5683}
  76.  
  77. };
  78.  
  79. #if MAX_MAP_OBJECTS != 0
  80. new Object[MAX_MAP_OBJECTS];
  81.  
  82. CreateMap()
  83. {
  84. Object[0] = CreateObject(19903,-1917.1569800,639.2388900,45.5165100,0.0000000,0.0000000,92.4600100); //
  85. Object[1] = CreateObject(19903,-1926.9942600,639.1651600,45.5165100,0.0000000,0.0000000,92.4600100); //
  86. Object[2] = CreateObject(2190,-1920.5046400,638.8864100,46.6175600,0.0000000,0.0000000,180.9000200); //
  87. Object[3] = CreateObject(3383,-1921.9122300,639.6029100,45.5628600,0.0000000,0.0000000,0.0000000); //
  88. Object[4] = CreateObject(19449,-1916.2100800,639.8951400,52.4401000,0.0000000,90.0000000,1800.0000000); //
  89. Object[5] = CreateObject(354,-1923.2518300,639.7293100,47.6154400,0.0000000,0.0000000,0.0000000); //
  90. Object[6] = CreateObject(354,-1921.1184100,639.6665600,47.6371300,0.0000000,0.0000000,0.0000000); //
  91. Object[7] = CreateObject(2908,-1923.0831300,639.7717300,46.6618700,0.0000000,90.0000000,-90.0000000); //
  92. Object[8] = CreateObject(2907,-1922.5830100,639.8042000,46.6167000,0.0000000,0.0000000,-90.0000000); //
  93. Object[9] = CreateObject(2906,-1922.6356200,639.5239900,46.6139500,0.0000000,0.0000000,-124.3800100); //
  94. Object[10] = CreateObject(2905,-1921.7828400,639.8706100,46.6394500,0.0000000,0.0000000,-90.0000000); //
  95. Object[11] = CreateObject(3675,-1917.5730000,652.7583000,51.2706000,0.0000000,0.0000000,-90.0000000); //
  96. Object[12] = CreateObject(3675,-1917.5730000,655.4498300,51.2706000,0.0000000,0.0000000,-90.0000000); //
  97. Object[13] = CreateObject(3675,-1917.5730000,657.8676800,51.2706000,0.0000000,0.0000000,-90.0000000); //
  98. Object[14] = CreateObject(9819,-1923.3176300,650.0571900,46.4414900,0.0000000,0.0000000,90.0000000); //
  99. Object[15] = CreateObject(3393,-1917.7061800,644.4429900,45.5453600,0.0000000,0.0000000,0.0000000); //
  100. Object[16] = CreateObject(10675,-1951.9462900,659.2756300,49.3085600,0.0000000,0.0000000,0.0000000); //
  101. Object[17] = CreateObject(1685,-1917.4967000,648.7882100,46.2534600,0.0000000,0.0000000,0.0000000); //
  102. Object[18] = CreateObject(3675,-1917.5730000,660.2581800,51.2706000,0.0000000,0.0000000,-90.0000000); //
  103. Object[19] = CreateObject(3675,-1917.5730000,662.8228100,51.2706000,0.0000000,0.0000000,-90.0000000); //
  104. Object[20] = CreateObject(3470,-1922.0819100,645.5271600,45.5833000,0.0000000,90.0000000,90.0000000); //
  105. Object[21] = CreateObject(3257,-1925.6503900,657.7735000,45.6263100,0.0000000,0.0000000,90.0000000); //
  106. Object[22] = CreateObject(3257,-1932.9851100,644.7775900,45.6263000,0.0000000,0.0000000,180.0000000); //
  107.  
  108. CreateVehicle(586, -1689.1031, 1040.3396, 17.1095, 90.0000, -1, -1, 100);
  109. CreateVehicle(586, -1689.0413, 1044.7971, 17.1095, 90.0000, -1, -1, 100);
  110. CreateVehicle(586, -1689.3944, 1048.1548, 17.1095, 90.0000, -1, -1, 100);
  111. CreateVehicle(586, -1689.3392, 1052.1312, 17.1095, 90.0000, -1, -1, 100);
  112. CreateVehicle(542, -1736.5881, 1059.1284, 17.3073, -90.0000, -1, -1, 100);
  113. CreateVehicle(542, -1736.1342, 1053.3311, 17.3073, -90.0000, -1, -1, 100);
  114. CreateVehicle(542, -1736.2415, 1048.7224, 17.3073, -90.0000, -1, -1, 100);
  115. CreateVehicle(542, -1736.3802, 1045.0112, 17.3073, -90.0000, -1, -1, 100);
  116. CreateVehicle(542, -1736.0746, 1041.1436, 17.3073, -90.0000, -1, -1, 100);
  117. CreateVehicle(542, -1736.1768, 1036.9763, 17.3073, -90.0000, -1, -1, 100);
  118. CreateVehicle(542, -1736.2611, 1033.0726, 17.3073, -90.0000, -1, -1, 100);
  119. CreateVehicle(463, -1735.8231, 1028.7996, 17.0190, -90.0000, -1, -1, 100);
  120. CreateVehicle(463, -1736.1193, 1024.6992, 17.0190, -90.0000, -1, -1, 100);
  121. CreateVehicle(463, -1736.0945, 1020.4105, 17.0190, -90.0000, -1, -1, 100);
  122. CreateVehicle(463, -1735.5815, 1016.7099, 17.0190, -90.0000, -1, -1, 100);
  123. CreateVehicle(463, -1735.7897, 1012.8233, 17.0190, -90.0000, -1, -1, 100);
  124.  
  125. }
  126. #endif
  127.  
  128.  
  129. //==============================================================================
  130. // Basic vars
  131. //==============================================================================
  132.  
  133. new bool:MissionStarted;
  134. new bool:ObjectiveStarted;
  135. new bool:MissionCancelled;
  136.  
  137. new bool:ObjectivePlaced;
  138.  
  139. native IsValidVehicle(vehicleid);
  140.  
  141. enum obj
  142. {
  143. ObjectiveName[30],
  144. BeingPlaced,
  145. ObjectiveTimer,
  146. ProgressTimer,
  147. ProgressCount,
  148. Count
  149. };
  150.  
  151. enum teamdata
  152. {
  153. Name[32],
  154. Members,
  155. Kills
  156. };
  157.  
  158. enum playerdata
  159. {
  160. UserName[MAX_PLAYER_NAME],
  161. bool:TeamChosen,
  162. TeamSelection,
  163. PlayerClassID
  164. };
  165.  
  166. new Team[2][teamdata];
  167. new PlayerMissionInfo[MAX_PLAYERS][playerdata];
  168. new ObjectiveInfo[obj];
  169.  
  170. new MaxExplosions;
  171. new FlashTimer;
  172.  
  173. //==============================================================================
  174. // Basic script
  175. //==============================================================================
  176.  
  177. main()
  178. {
  179. print("----------------------------------");
  180. print(" Mission: "MISSION_NAME" started.");
  181. print("----------------------------------\n");
  182. }
  183.  
  184. public OnGameModeInit()
  185. {
  186. MissionStarted= true;
  187. format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
  188. format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
  189.  
  190. format(ObjectiveInfo[ObjectiveName],sizeof(ObjectiveInfo[ObjectiveName]),"%s",OBJ_NAME);
  191.  
  192. CallRemoteFunction("CreateBombingTD","d",PLACING_TIME*10);
  193.  
  194. MaxExplosions= sizeof(ExplosionsInfo);
  195. ObjectivePlaced= false;
  196. ObjectiveInfo[BeingPlaced]=-1;
  197.  
  198. #if MAX_MAP_OBJECTS != 0
  199. CreateMap();
  200. #endif
  201.  
  202. for(new i=0; i<sizeof(SkinData); i++)
  203. {
  204. 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);
  205. }
  206.  
  207. for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
  208.  
  209. for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
  210.  
  211. if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
  212. SetTimer("StartMissionFunc",3000,false);
  213. return 1;
  214. }
  215.  
  216. FUNCTION StartMissionFunc()
  217. {
  218. CallRemoteFunction("StartMission","");
  219. ObjectiveStarted= true;
  220. return 1;
  221. }
  222.  
  223. public OnGameModeExit()
  224. {
  225. #if MAX_MAP_OBJECTS != 0
  226. for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
  227. #endif
  228. for(new i=0; i<MAX_VEHICLES; i++)
  229. {
  230. DestroyVehicle(i);
  231. }
  232. return 1;
  233. }
  234.  
  235. public OnPlayerDisconnect(playerid)
  236. {
  237. if(PlayerMissionInfo[playerid][TeamChosen])
  238. {
  239. Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
  240. PlayerMissionInfo[playerid][TeamChosen]=false;
  241. }
  242. return 1;
  243. }
  244.  
  245. public OnPlayerRequestClass(playerid,classid)
  246. {
  247. SetPlayerPos(playerid,CLASS_POSTION);
  248. SetPlayerCameraPos(playerid,CLASS_CAMERA);
  249. SetPlayerCameraLookAt(playerid,CLASS_POSTION);
  250. SetPlayerFacingAngle(playerid,CLASS_FACING_AGNLE);
  251.  
  252. CallRemoteFunction("ShowClassSelection","iisiii",playerid, SkinData[classid][TeamID],Team[SkinData[classid][TeamID]][Name], SkinData[classid][Weapon1], SkinData[classid][Weapon2], SkinData[classid][Weapon3]);
  253.  
  254. if(PlayerMissionInfo[playerid][TeamChosen])
  255. {
  256. PlayerMissionInfo[playerid][TeamChosen] = false;
  257. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
  258. }
  259.  
  260. PlayerMissionInfo[playerid][TeamSelection] = SkinData[classid][TeamID];
  261. PlayerMissionInfo[playerid][PlayerClassID]=classid;
  262. return 1;
  263. }
  264.  
  265. public OnPlayerRequestSpawn(playerid)
  266. {
  267. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  268. if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
  269. {
  270. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This Team is full, choose another!",0);
  271. return 0;
  272. }
  273. return 1;
  274. }
  275.  
  276.  
  277. public OnPlayerSpawn(playerid)
  278. {
  279. new string[124];
  280. CallRemoteFunction("UpdateAliveState","ii",playerid,1);
  281. if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
  282. if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
  283. else
  284. {
  285. SetPlayerPos(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
  286. SetPlayerInterior(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
  287. SetPlayerFacingAngle(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
  288. SetPlayerVirtualWorld(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
  289. if(!PlayerMissionInfo[playerid][TeamChosen])
  290. {
  291. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
  292. PlayerMissionInfo[playerid][TeamChosen] = true;
  293. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  294. {
  295. format(string,sizeof(string),"You are a %s, your mission is to destroy the %s.",Team[TEAM_ATTACK][Name],ObjectiveInfo[ObjectiveName]);
  296. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  297. format(string,sizeof(string),"%s will try to stop you, eliminate them!.",Team[TEAM_DEFEND][Name]);
  298. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string,4000);
  299. format(string,sizeof(string),"Destroy the ~y~%s~w~!",ObjectiveInfo[ObjectiveName]);
  300. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  301. }
  302. else
  303. {
  304. 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]);
  305. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  306. format(string,sizeof(string),"Protect the ~y~%s~w~!.",ObjectiveInfo[ObjectiveName]);
  307. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  308. }
  309. }
  310. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
  311. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
  312. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
  313. }
  314. SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
  315. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
  316. else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
  317.  
  318. SetPlayerHealth(playerid,Health);
  319. #if SPAWN_PROTECTION == true
  320. CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
  321. #endif
  322.  
  323. CallRemoteFunction("OnPlayerBombingData", "ii", playerid, 1);
  324.  
  325. SetPlayerCheckpoint(playerid,CP_POS,CP_SIZE);
  326. return 1;
  327. }
  328.  
  329. public OnPlayerDeath(playerid, killerid, reason)
  330. {
  331. new string[128];
  332. if(killerid != INVALID_PLAYER_ID)
  333. {
  334. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  335. Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
  336. }
  337. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  338. {
  339. if(!ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
  340. {
  341. ObjectiveInfo[BeingPlaced]=-1;
  342. format(string,sizeof(string),"~y~%s ~w~has died while ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName]);
  343. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  344. ObjectiveInfo[Count]=0;
  345. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  346. ObjectiveInfo[ProgressCount]=0;
  347. KillTimer(ObjectiveInfo[ProgressTimer]);
  348. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  349. }
  350. }
  351. CallRemoteFunction("UpdateAliveState","ii",playerid,0);
  352. return 1;
  353. }
  354.  
  355. public OnPlayerEnterCheckpoint(playerid)
  356. {
  357. if(!MissionStarted || ObjectivePlaced) return 1;
  358. new string[128];
  359. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced)
  360. {
  361. if(ObjectiveInfo[BeingPlaced] != -1)
  362. {
  363. format(string,sizeof(string),"%s is already trying to place the bomb. Please wait!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
  364. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  365. }
  366. else
  367. {
  368. ObjectiveInfo[BeingPlaced]=playerid;
  369. format(string,sizeof(string),"~y~%s~w~ is placing the bomb..!!",PlayerMissionInfo[playerid][UserName],playerid);
  370. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  371. format(string,sizeof(string),"Wait in the checkpoint for %d seconds to place the bomb.",PLACING_TIME);
  372. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  373. ObjectiveInfo[Count]=0;
  374. ObjectiveInfo[ProgressCount]=0;
  375. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  376. ObjectiveInfo[ObjectiveTimer] = SetTimer("PlacingTimer",1000,true);
  377. ObjectiveInfo[ProgressTimer] = SetTimer("ProgressFillUP",100,true);
  378. }
  379. }
  380. else
  381. {
  382. if(ObjectiveInfo[BeingPlaced] != -1)
  383. {
  384. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This is bomb placing sight, protect it.", 0);
  385. }
  386. else
  387. {
  388. format(string,sizeof(string),"%s is trying to place the bomb. Stop them!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
  389. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
  390. }
  391. }
  392. return 1;
  393. }
  394.  
  395. public OnPlayerLeaveCheckpoint(playerid)
  396. {
  397. if(!MissionStarted || ObjectivePlaced) return 1;
  398. new string[128];
  399. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
  400. {
  401. ObjectiveInfo[BeingPlaced]=-1;
  402. format(string,sizeof(string),"~y~%s~w~ has left ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName],playerid);
  403. CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
  404. ObjectiveInfo[Count]=0;
  405. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  406. ObjectiveInfo[ProgressCount]=0;
  407. KillTimer(ObjectiveInfo[ProgressTimer]);
  408. CallRemoteFunction("UpdateBombProgressBar", "d", 0);
  409. }
  410. return 1;
  411. }
  412.  
  413. public OnVehicleSpawn(vehicleid)
  414. {
  415. SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
  416. return 1;
  417. }
  418.  
  419. FUNCTION EndTheMission()
  420. {
  421. if(!MissionStarted) return 1;
  422. MissionStarted= false;
  423. if(!MissionCancelled)
  424. {
  425. new string[256];
  426. new amount= 10000;
  427. if(!ObjectivePlaced)
  428. {
  429. amount+=Team[TEAM_DEFEND][Kills]*100;
  430. 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);
  431. SendClientMessageToAll(COLOR_SERVER,string);
  432. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  433. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  434. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  435. {
  436. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  437. if(PlayerMissionInfo[i][TeamSelection] == TEAM_DEFEND)
  438. {
  439. PlayerPlaySound(i,3200,0,0,0);
  440. SendClientMessage(i,COLOR_TEAM_DEFEND,string);
  441. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  442. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  443. }
  444. if(PlayerMissionInfo[i][TeamSelection] != TEAM_DEFEND)
  445. {
  446. PlayerPlaySound(i,17004,0,0,0);
  447. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  448. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  449. }
  450. }
  451. }
  452. else
  453. {
  454. amount+=Team[TEAM_ATTACK][Kills]*100;
  455. 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]);
  456. SendClientMessageToAll(COLOR_SERVER,string);
  457. format(string,sizeof(string),""SERVER_KEY_MSG" %s have won the mission. Reward: $%d.",Team[TEAM_ATTACK][Name],amount);
  458. SendClientMessageToAll(COLOR_SERVER,string);
  459. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  460. CallRemoteFunction("PlayerMissionStats","dd",ObjectiveInfo[BeingPlaced],8);
  461. CallRemoteFunction("GivePlayerToken","dd",ObjectiveInfo[BeingPlaced],1);
  462. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the Team-Deathmatch!",amount);
  463. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  464. {
  465. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  466. if(PlayerMissionInfo[i][TeamSelection] == TEAM_ATTACK)
  467. {
  468. PlayerPlaySound(i,3200,0,0,0);
  469. SendClientMessage(i,COLOR_TEAM_ATTACK,string);
  470. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  471. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  472. }
  473. if(PlayerMissionInfo[i][TeamSelection] != TEAM_ATTACK)
  474. {
  475. PlayerPlaySound(i,17004,0,0,0);
  476. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  477. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  478. }
  479. }
  480. }
  481. }
  482. else
  483. {
  484. PlaySoundForAll(1058);
  485. SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
  486. CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
  487. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
  488. GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
  489. }
  490. return 1;
  491. }
  492.  
  493. //==============================================================================
  494. // Mission functions
  495. //==============================================================================
  496.  
  497. FUNCTION ProgressFillUP()
  498. {
  499. ObjectiveInfo[ProgressCount]++;
  500. CallRemoteFunction("UpdateBombProgressBar", "d", ObjectiveInfo[ProgressCount]);
  501. }
  502.  
  503. FUNCTION PlacingTimer()
  504. {
  505. if(!MissionStarted || ObjectivePlaced) return 1;
  506. if(ObjectiveInfo[BeingPlaced] == -1)
  507. {
  508. ObjectiveInfo[Count]=0;
  509. ObjectiveInfo[ProgressCount]=0;
  510. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  511. KillTimer(ObjectiveInfo[ProgressTimer]);
  512. }
  513. ObjectiveInfo[Count]++;
  514. if(ObjectiveInfo[Count] == PLACING_TIME)
  515. {
  516. ObjectivePlaced=true;
  517. new string[128],id=ObjectiveInfo[BeingPlaced];
  518. format(string,sizeof(string),""SERVER_KEY_MSG" %s (%d) has successfully planted the bomb, 15 seconds before the bomb explodes.",PlayerMissionInfo[id][UserName],id);
  519. SendClientMessageToAll(COLOR_SERVER,string);
  520. SetTimerEx("Explosion",15000,false,"ii",0,5);
  521. KillTimer(ObjectiveInfo[ObjectiveTimer]);
  522. KillTimer(ObjectiveInfo[ProgressTimer]);
  523. FlashTimer= SetTimer("FlasBomb",500,true);
  524. CallRemoteFunction("FlashBombBar", "");
  525. CallRemoteFunction("UpdateBombInfo", "");
  526. CallRemoteFunction("KillGameModeTimer","");
  527. CallRemoteFunction("TD_Clock","s","_");
  528. DisableCheckpointForAll();
  529. }
  530. return 1;
  531. }
  532. FUNCTION FlasBomb()
  533. {
  534. CallRemoteFunction("FlashBombBar", "");
  535. return 1;
  536. }
  537.  
  538. FUNCTION Explosion(start, until)
  539. {
  540. for(new i = start; i < until; i++)
  541. {
  542. if(i >= MaxExplosions) break;
  543. CreateExplosion(ExplosionsInfo[i][0], ExplosionsInfo[i][1], ExplosionsInfo[i][2] , 7, 20.0);
  544. }
  545.  
  546. start += 5;
  547. until += 5;
  548.  
  549. if(until > MaxExplosions)
  550. {
  551. CallRemoteFunction("EndMission","");
  552. KillTimer(FlashTimer);
  553. }
  554. else
  555. {
  556. SetTimerEx("Explosion", 1000, false, "ii", start, until);
  557. }
  558. return 1;
  559. }
  560. DisableCheckpointForAll()
  561. {
  562. for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  563. {
  564. if(!IsPlayerConnected(i)) continue;
  565. DisablePlayerCheckpoint(i);
  566. }
  567. }
  568. PlaySoundForAll(sound)
  569. {
  570. for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  571. {
  572. if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
  573. }
  574. }
  575.  
  576. //==============================================================================
  577. // Important functions required
  578. //==============================================================================
  579.  
  580. FUNCTION OnPlayerNameRecieve(playerid,name[])
  581. {
  582. format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
  583. return 1;
  584. }
  585.  
  586. FUNCTION CancelTheMission()
  587. {
  588. MissionCancelled= true;
  589. return 1;
  590. }
  591.  
  592. FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
  593.  
  594. FUNCTION OnPlayerSpectateObjective(playerid)
  595. {
  596. SetPlayerCameraPos(playerid, CP_POS + 2.5);
  597. SetPlayerCameraLookAt(playerid, CP_POS);
  598. SetPlayerPos(playerid, CP_POS - 5);
  599.  
  600. SetPlayerColor(playerid, (PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) ? COLOR_TEAM_ATTACK_INV : COLOR_TEAM_DEFEND_INV);
  601. return 1;
  602. }
Advertisement
Add Comment
Please, Sign In to add comment