Bulletje

Untitled

Jan 24th, 2017
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 23.01 KB | None | 0 0
  1. /*
  2. Script by: Bullet
  3. Map by: Bullet
  4. Mission Base: Stealing
  5. Mission Type: Vehicle stealing
  6. Mission Type ID: 3
  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 "Sky Town"
  23. #define Health 99.0
  24. #define TEAM_DEFEND_NAME "Citizens"
  25. #define TEAM_ATTACK_NAME "Hobos"
  26. #define MAX_MAP_OBJECTS 49
  27. #define VEHICLE_HEALTH 999.0
  28. #define CLASS_POSTION 349.9381,147.0020,1518.6313
  29. #define CLASS_CAMERA 345.3366,146.7728,1520.6313
  30. #define CLASS_FACING_AGNLE 94.3672
  31. #define OBJ_POS 355.7650,203.1576,1500.7472,272.7633
  32. #define OBJ_ID 522
  33. #define OBJ_NAME "Bike"
  34. #define CP_POS 518.9354,171.5411,1501.1899
  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.  
  61. {TEAM_ATTACK, 212,494.8993,171.5156,1501.1899,90.2124,0,0,WEAPON_SILENCED,70,WEAPON_M4,200,0,0},
  62. {TEAM_DEFEND, 234,361.3232,175.5674,1501.1744,268.4081,0,0,WEAPON_DEAGLE,70,WEAPON_AK47,200,0,0}
  63.  
  64. };
  65.  
  66. #if MAX_MAP_OBJECTS != 0
  67. new Object[MAX_MAP_OBJECTS];
  68.  
  69. CreateMap()
  70. {
  71. Object[0] = CreateObject(8664,422.5328100,154.4313000,1500.0963100,0.0000000,0.0000000,0.0000000); //
  72. Object[1] = CreateObject(17700,377.9726300,253.4915500,1505.0277100,0.0000000,0.0000000,-268.1999800); //
  73. Object[2] = CreateObject(17700,344.8277900,192.7537700,1506.5771500,0.0000000,0.0000000,-268.1999800); //
  74. Object[3] = CreateObject(17699,347.9403100,179.3568300,1504.2644000,0.0000000,0.0000000,-359.3998700); //
  75. Object[4] = CreateObject(17523,418.9091800,237.8929900,1501.9559300,0.0000000,0.0000000,450.4795500); //
  76. Object[5] = CreateObject(5175,443.9011200,250.4524500,1506.9599600,0.0000000,0.0000000,45.4198300); //
  77. Object[6] = CreateObject(4028,497.2677000,230.6561300,1513.4300500,0.0000000,0.0000000,0.0000000); //
  78. Object[7] = CreateObject(4028,502.7156700,212.0692000,1513.4300500,0.0000000,0.0000000,-90.0000200); //
  79. Object[8] = CreateObject(6332,393.6592400,83.1221700,1513.7567100,0.0000000,0.0000000,90.0000200); //
  80. Object[9] = CreateObject(6332,503.0554800,109.7647800,1513.1212200,0.0000000,0.0000000,-180.0001500); //
  81. Object[10] = CreateObject(6390,306.5016500,111.6905000,1509.2716100,0.0000000,0.0000000,-0.0000300); //
  82. Object[11] = CreateObject(6390,333.1899100,116.1613800,1505.2563500,0.0000000,0.0000000,-85.5000200); //
  83. Object[12] = CreateObject(6211,454.1393100,76.6469800,1503.4036900,0.0000000,0.0000000,-89.9999800); //
  84. Object[13] = CreateObject(6332,426.3976700,50.7227900,1513.7567100,0.0000000,0.0000000,153.3599900); //
  85. Object[14] = CreateObject(8566,373.4074100,149.0597500,1500.0520000,0.0000000,0.0000000,0.0000000); //
  86. Object[15] = CreateObject(8568,424.8049300,127.3452200,1504.2265600,0.0000000,0.0000000,0.0000000); //
  87. Object[16] = CreateObject(10610,409.3934900,250.8370700,1510.4440900,0.0000000,0.0000000,0.0000000); //
  88. Object[17] = CreateObject(8565,428.8584900,205.0651900,1505.6307400,0.0000000,0.0000000,0.0000000); //
  89. Object[18] = CreateObject(5711,455.6335100,167.8432900,1503.4561800,0.0000000,0.0000000,0.0000000); //
  90. Object[19] = CreateObject(9310,362.3967600,101.6866600,1505.9932900,0.0000000,0.0000000,0.0000000); //
  91. Object[20] = CreateObject(8230,362.5258800,118.9022800,1501.7810100,0.0000000,0.0000000,-180.0002400); //
  92. Object[21] = CreateObject(8230,362.6294600,136.5499300,1501.7810100,0.0000000,0.0000000,-180.0002400); //
  93. Object[22] = CreateObject(8230,362.8084700,136.5309400,1505.4395800,0.0000000,0.0000000,-180.0002400); //
  94. Object[23] = CreateObject(8230,362.7053200,118.8831000,1505.6799300,0.0000000,0.0000000,-180.0002400); //
  95. Object[24] = CreateObject(10631,392.8292800,107.8709400,1504.2274200,0.0000000,0.0000000,0.0000000); //
  96. Object[25] = CreateObject(11008,391.5167500,194.5702500,1506.8305700,0.0000000,0.0000000,0.0000000); //
  97. Object[26] = CreateObject(16563,445.1725500,136.7497100,1498.4719200,0.0000000,0.0000000,0.0000000); //
  98. Object[27] = CreateObject(16287,441.3108800,182.8490000,1499.9772900,0.0000000,0.0000000,90.0000200); //
  99. Object[28] = CreateObject(16287,426.3248900,182.8401900,1499.9772900,0.0000000,0.0000000,90.0000000); //
  100. Object[29] = CreateObject(6332,517.6047400,88.5145300,1513.1212200,0.0000000,0.0000000,-269.9998500); //
  101. Object[30] = CreateObject(4199,468.5321000,207.7163500,1502.0871600,0.0000000,0.0000000,0.0000000); //
  102. Object[31] = CreateObject(4892,511.7748400,167.3436300,1502.5997300,0.0000000,0.0000000,90.0000200); //
  103. Object[32] = CreateObject(6332,536.8450900,152.0094100,1513.1212200,0.0000000,0.0000000,-180.0001500); //
  104. Object[33] = CreateObject(6332,547.0435200,149.6632800,1513.1212200,0.0000000,0.0000000,-270.0000600); //
  105. Object[34] = CreateObject(6332,553.8574800,185.5469100,1513.1212200,0.0000000,0.0000000,-90.0002000); //
  106. Object[35] = CreateObject(16067,421.7327900,165.3416100,1499.9506800,0.0000000,0.0000000,0.0000000); //
  107. Object[36] = CreateObject(16070,383.3887300,133.6143200,1505.3772000,0.0000000,0.0000000,0.0000000); //
  108. Object[37] = CreateObject(3631,457.8663900,118.1205100,1500.6711400,0.0000000,0.0000000,0.0000000); //
  109. Object[38] = CreateObject(3631,457.8663900,118.1205100,1501.6862800,0.0000000,0.0000000,-19.3800000); //
  110. Object[39] = CreateObject(3865,438.5766900,146.3719200,1501.6723600,0.0000000,0.0000000,-270.0000000); //
  111. Object[40] = CreateObject(3865,429.3612100,146.2598100,1501.6723600,0.0000000,0.0000000,-449.9997300); //
  112. Object[41] = CreateObject(3865,420.3170500,146.5242000,1501.6723600,0.0000000,0.0000000,-630.0001800); //
  113. Object[42] = CreateObject(3865,411.1033000,146.4047900,1501.6723600,0.0000000,0.0000000,-809.9998800); //
  114. Object[43] = CreateObject(3865,402.9203800,146.4265900,1503.0636000,-20.0000000,0.0000000,-809.9998800); //
  115. Object[44] = CreateObject(3865,396.7132300,146.5973100,1497.6142600,90.0000000,90.0000000,-889.3798200); //
  116. Object[45] = CreateObject(16564,473.6767900,121.7926900,1500.0606700,0.0000000,0.0000000,-89.9999900); //
  117. Object[46] = CreateObject(8664,517.5587800,96.1911800,1500.1118200,0.0000000,0.0000000,0.0000000); //
  118. Object[47] = CreateObject(8664,512.2069700,241.1320300,1500.1118200,0.0000000,0.0000000,90.0000300); //
  119. Object[48] = CreateObject(8664,372.5615200,73.7987100,1500.1218300,0.0000000,0.0000000,-90.0000000); //
  120. }
  121. #endif
  122.  
  123.  
  124. //==============================================================================
  125. // Basic vars
  126. //==============================================================================
  127.  
  128. new bool:MissionStarted;
  129. new bool:ObjectiveStarted;
  130. new bool:MissionCancelled;
  131.  
  132. new bool:ObjectiveStolen;
  133. new ObjectiveStolenBy;
  134.  
  135. native IsValidVehicle(vehicleid);
  136.  
  137. enum obj
  138. {
  139. ObjectiveVeh,
  140. ObjectiveName[30],
  141. ObjectiveMarker,
  142. Float:ObjectiveEndX,
  143. Float:ObjectiveEndY,
  144. Float:ObjectiveEndZ
  145. };
  146.  
  147. enum teamdata
  148. {
  149. Name[32],
  150. Members,
  151. Kills
  152. };
  153.  
  154. enum playerdata
  155. {
  156. UserName[MAX_PLAYER_NAME],
  157. bool:TeamChosen,
  158. TeamSelection,
  159. PlayerClassID
  160. };
  161. new Team[2][teamdata];
  162. new PlayerMissionInfo[MAX_PLAYERS][playerdata];
  163. new ObjectiveInfo[obj];
  164.  
  165. //==============================================================================
  166. // Basic script
  167. //==============================================================================
  168.  
  169. main()
  170. {
  171. print("----------------------------------");
  172. print(" Mission: "MISSION_NAME" started.");
  173. print("----------------------------------\n");
  174. }
  175.  
  176. public OnGameModeInit()
  177. {
  178. MissionStarted= true;
  179. format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
  180. format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
  181.  
  182. format(ObjectiveInfo[ObjectiveName],sizeof(ObjectiveInfo[ObjectiveName]),"%s",OBJ_NAME);
  183.  
  184. ObjectiveInfo[ObjectiveVeh] = CreateVehicle(OBJ_ID,OBJ_POS,random(225),random(225),3);
  185. SetVehicleHealth(ObjectiveInfo[ObjectiveVeh],1100);
  186.  
  187. new iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective;
  188. GetVehicleParamsEx(ObjectiveInfo[ObjectiveVeh], iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
  189. SetVehicleParamsEx(ObjectiveInfo[ObjectiveVeh], iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, 1);
  190.  
  191. AddStaticVehicleEx(461,3237.6956000,1286.4359000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  192. AddStaticVehicleEx(461,3309.9316000,1285.8105000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
  193. AddStaticVehicleEx(461,3301.4075000,1285.6240000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
  194. AddStaticVehicleEx(461,3286.8469000,1286.7267000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
  195. AddStaticVehicleEx(461,3277.0708000,1286.9576000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
  196. AddStaticVehicleEx(461,3262.3457000,1285.7395000,6.7734000,-187.8600000,-1,-1,15); //PCJ-600
  197. AddStaticVehicleEx(461,3252.6736000,1286.3423000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
  198. AddStaticVehicleEx(461,3228.2878000,1285.9712000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  199. AddStaticVehicleEx(461,3214.0562000,1286.0695000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  200. AddStaticVehicleEx(461,3203.4856000,1285.7783000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  201. AddStaticVehicleEx(461,3190.1631000,1287.0400000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  202. AddStaticVehicleEx(461,3178.7856000,1287.3003000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  203. AddStaticVehicleEx(461,3164.5676000,1286.5919000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  204. AddStaticVehicleEx(461,3149.8867000,1287.0842000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  205. AddStaticVehicleEx(461,3135.2725000,1287.9214000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
  206. AddStaticVehicleEx(461,3244.4565000,861.1821000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
  207. AddStaticVehicleEx(461,3246.8936000,861.1639000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
  208. AddStaticVehicleEx(461,3249.0422000,861.0303000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
  209. AddStaticVehicleEx(461,3250.9873000,861.1275000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
  210. AddStaticVehicleEx(461,3242.0303000,861.1588000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
  211. AddStaticVehicleEx(461,3239.2468000,861.2847000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
  212.  
  213. #if MAX_MAP_OBJECTS != 0
  214. CreateMap();
  215. #endif
  216.  
  217. for(new i=0; i<sizeof(SkinData); i++)
  218. {
  219. 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);
  220. }
  221.  
  222. for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
  223.  
  224. for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
  225.  
  226. if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
  227. SetTimer("StartMissionFunc",3000,false);
  228. return 1;
  229. }
  230.  
  231. FUNCTION StartMissionFunc()
  232. {
  233. CallRemoteFunction("StartMission","");
  234. ObjectiveStarted= true;
  235. return 1;
  236. }
  237.  
  238. public OnGameModeExit()
  239. {
  240. #if MAX_MAP_OBJECTS != 0
  241. for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
  242. #endif
  243. for(new i=0; i<MAX_VEHICLES; i++)
  244. {
  245. DestroyVehicle(i);
  246. }
  247. return 1;
  248. }
  249.  
  250. public OnPlayerDisconnect(playerid)
  251. {
  252. if(PlayerMissionInfo[playerid][TeamChosen] && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM)
  253. {
  254. Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
  255. PlayerMissionInfo[playerid][TeamChosen]=false;
  256. }
  257. return 1;
  258. }
  259.  
  260. public OnPlayerRequestClass(playerid,classid)
  261. {
  262. SetPlayerPos(playerid,CLASS_POSTION);
  263. SetPlayerCameraPos(playerid,CLASS_CAMERA);
  264. SetPlayerCameraLookAt(playerid,CLASS_POSTION);
  265. SetPlayerFacingAngle(playerid,CLASS_FACING_AGNLE);
  266.  
  267. CallRemoteFunction("ShowClassSelection","iisiii",playerid, SkinData[classid][TeamID],Team[SkinData[classid][TeamID]][Name], SkinData[classid][Weapon1], SkinData[classid][Weapon2], SkinData[classid][Weapon3]);
  268.  
  269. if(PlayerMissionInfo[playerid][TeamChosen])
  270. {
  271. PlayerMissionInfo[playerid][TeamChosen] = false;
  272. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
  273. }
  274.  
  275. PlayerMissionInfo[playerid][TeamSelection] = SkinData[classid][TeamID];
  276. PlayerMissionInfo[playerid][PlayerClassID]=classid;
  277. return 1;
  278. }
  279.  
  280. public OnPlayerRequestSpawn(playerid)
  281. {
  282. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  283. if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
  284. {
  285. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This Team is full, choose another!",0);
  286. return 0;
  287. }
  288. return 1;
  289. }
  290.  
  291.  
  292.  
  293. public OnPlayerSpawn(playerid)
  294. {
  295. SetPlayerHealth(playerid,Health);
  296. new string[124];
  297. CallRemoteFunction("UpdateAliveState","ii",playerid,1);
  298. if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
  299. if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
  300. else
  301. {
  302. SetPlayerPos(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
  303. SetPlayerInterior(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
  304. SetPlayerFacingAngle(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
  305. SetPlayerVirtualWorld(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
  306. if(!PlayerMissionInfo[playerid][TeamChosen])
  307. {
  308. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
  309. PlayerMissionInfo[playerid][TeamChosen] = true;
  310. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  311. {
  312. format(string,sizeof(string),"You are a %s, your mission is to steal the %s.",Team[TEAM_ATTACK][Name],ObjectiveInfo[ObjectiveName]);
  313. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  314. format(string,sizeof(string),"%s will try to stop you, eliminate them!.",Team[TEAM_DEFEND][Name]);
  315. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string,4000);
  316. format(string,sizeof(string),"Steal the ~y~%s~w~!",ObjectiveInfo[ObjectiveName]);
  317. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  318. }
  319. else
  320. {
  321. 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]);
  322. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  323. format(string,sizeof(string),"Protect the ~y~%s~w~!.",ObjectiveInfo[ObjectiveName]);
  324. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  325. }
  326. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
  327. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
  328. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
  329. }
  330. }
  331. SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
  332. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
  333. else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
  334. #if SPAWN_PROTECTION == true
  335. CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
  336. #endif
  337.  
  338. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_DEFEND) SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],playerid,1,1);
  339. else SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],playerid,1,0);
  340. return 1;
  341. }
  342.  
  343. public OnPlayerDeath(playerid, killerid, reason)
  344. {
  345. if(killerid != INVALID_PLAYER_ID)
  346. {
  347. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  348. Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
  349. }
  350. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  351. {
  352. if(GetPlayerVehicleID(playerid) == ObjectiveInfo[ObjectiveVeh])
  353. {
  354. new string[124];
  355. format(string,sizeof(string),"%s has died and left the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  356. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  357. DisablePlayerRaceCheckpoint(playerid);
  358. }
  359. }
  360. CallRemoteFunction("UpdateAliveState","ii",playerid,0);
  361. return 1;
  362. }
  363.  
  364. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  365. {
  366. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  367. {
  368. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  369. {
  370. new string[124];
  371. format(string,sizeof(string),"%s is stealing the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  372. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  373. SetPlayerCheckpoint(playerid,CP_POS,10.0);
  374. }
  375. }
  376. else
  377. {
  378. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  379. {
  380. new Float:x,Float:y,Float:z;
  381. GetPlayerPos(playerid,x,y,z);
  382. SetPlayerPos(playerid,x,y,z+3);
  383. ClearAnimations(playerid);
  384. }
  385. }
  386. return 1;
  387. }
  388.  
  389. public OnPlayerExitVehicle(playerid, vehicleid)
  390. {
  391. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  392. {
  393. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  394. {
  395. new string[124];
  396. format(string,sizeof(string),"%s has left the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  397. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  398. DisablePlayerCheckpoint(playerid);
  399. }
  400. }
  401. }
  402.  
  403. public OnPlayerEnterCheckpoint(playerid)
  404. {
  405. if(!MissionStarted || ObjectiveStolen) return 1;
  406. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  407. {
  408. if(GetPlayerVehicleID(playerid) == ObjectiveInfo[ObjectiveVeh])
  409. {
  410. new string[124];
  411. format(string,sizeof(string),"%s has stolen the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  412. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  413. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++) if(IsPlayerConnected(i)) DisablePlayerCheckpoint(i);
  414. DestroyVehicle(ObjectiveInfo[ObjectiveVeh]);
  415. ObjectiveStolen= true;
  416. ObjectiveStolenBy=playerid;
  417. CallRemoteFunction("EndMission","");
  418. PlayerPlaySound(playerid,1097,0,0,0);
  419. }
  420. }
  421. return 1;
  422. }
  423.  
  424.  
  425.  
  426. public OnVehicleStreamIn(vehicleid, forplayerid)
  427. {
  428. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  429. {
  430.  
  431. if(PlayerMissionInfo[forplayerid][TeamSelection] == TEAM_DEFEND) SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],forplayerid,1,1);
  432. else SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],forplayerid,1,0);
  433. }
  434. return 1;
  435. }
  436.  
  437. public OnVehicleSpawn(vehicleid)
  438. {
  439. SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
  440. if(vehicleid == ObjectiveInfo[ObjectiveVeh]) SetVehicleHealth(ObjectiveInfo[ObjectiveVeh],VEHICLE_HEALTH + (100*Team[TEAM_DEFEND][Members]));
  441. return 1;
  442. }
  443.  
  444.  
  445. FUNCTION EndTheMission()
  446. {
  447. if(!MissionStarted) return 1;
  448. MissionStarted= false;
  449. if(!MissionCancelled)
  450. {
  451. new string[128];
  452. new amount= 10000;
  453. if(!ObjectiveStolen)
  454. {
  455. amount+=Team[TEAM_DEFEND][Kills]*100;
  456. 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);
  457. SendClientMessageToAll(COLOR_SERVER,string);
  458. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  459. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  460. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  461. {
  462. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  463. if(PlayerMissionInfo[i][TeamSelection] == TEAM_DEFEND)
  464. {
  465. PlayerPlaySound(i,3200,0,0,0);
  466. SendClientMessage(i,COLOR_TEAM_DEFEND,string);
  467. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  468. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  469. }
  470. if(PlayerMissionInfo[i][TeamSelection] != TEAM_DEFEND)
  471. {
  472. PlayerPlaySound(i,17004,0,0,0);
  473. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  474. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  475. }
  476. }
  477. }
  478. else
  479. {
  480. amount+=Team[TEAM_ATTACK][Kills]*100;
  481. format(string,sizeof(string),""SERVER_KEY_MSG" %s (%d) has stolen %s for %s to win the mission. Reward: $%d + Token",PlayerMissionInfo[ObjectiveStolenBy][UserName],ObjectiveInfo[ObjectiveName],ObjectiveStolenBy,Team[TEAM_ATTACK][Name],amount);
  482. SendClientMessageToAll(COLOR_SERVER,string);
  483. CallRemoteFunction("PlayerMissionStats","dd",ObjectiveStolenBy,7);
  484. CallRemoteFunction("GivePlayerToken","dd",ObjectiveStolenBy,1);
  485. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  486. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  487. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  488. {
  489. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  490. if(PlayerMissionInfo[i][TeamSelection] == TEAM_ATTACK)
  491. {
  492. PlayerPlaySound(i,3200,0,0,0);
  493. SendClientMessage(i,COLOR_TEAM_ATTACK,string);
  494. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  495. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  496. }
  497. if(PlayerMissionInfo[i][TeamSelection] != TEAM_ATTACK)
  498. {
  499. PlayerPlaySound(i,17004,0,0,0);
  500. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  501. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  502. }
  503. }
  504. }
  505. }
  506. else
  507. {
  508. PlaySoundForAll(1058);
  509. SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
  510. CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
  511. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
  512. GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
  513. }
  514. return 1;
  515. }
  516.  
  517. //==============================================================================
  518. // Mission functions
  519. //==============================================================================
  520.  
  521. PlaySoundForAll(sound)
  522. {
  523. for (new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  524. {
  525. if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
  526. }
  527. }
  528.  
  529. //==============================================================================
  530. // Important functions required
  531. //==============================================================================
  532.  
  533. FUNCTION OnPlayerNameRecieve(playerid,name[])
  534. {
  535. format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
  536. return 1;
  537. }
  538.  
  539. FUNCTION CancelTheMission()
  540. {
  541. MissionCancelled= true;
  542. return 1;
  543. }
  544.  
  545. FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
Advertisement
Add Comment
Please, Sign In to add comment