Bulletje

Untitled

Feb 20th, 2017
51
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.27 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 "Grand Theft Bike"
  23. #define Health 99.0
  24. #define TEAM_DEFEND_NAME "Mafia"
  25. #define TEAM_ATTACK_NAME "Russian"
  26. #define MAX_MAP_OBJECTS 10
  27. #define VEHICLE_HEALTH 999.0
  28. #define CLASS_POSTION 2594.0273,2393.2974,17.5443
  29. #define CLASS_CAMERA 2598.1211,2395.4849,17.8203
  30. #define CLASS_FACING_AGNLE 299.3985
  31. #define OBJ_POS -2291.9819,1746.8385,6.4788,59.6400
  32. #define OBJ_ID 522
  33. #define OBJ_NAME "Bike"
  34. #define CP_POS -2399.8987,1952.3320,20.3731
  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,113,-2408.2507,1985.0962,19.0050,179.2792,0,0,WEAPON_SNIPER,210,WEAPON_M4,300,WEAPON_SHOTGUN,300},
  61. {TEAM_DEFEND,124,-2177.8948,1527.8690,14.1751,356.6401,0,0,WEAPON_SNIPER,210,WEAPON_M4,300,WEAPON_SHOTGUN,300}
  62. };
  63.  
  64. #if MAX_MAP_OBJECTS != 0
  65. new Object[MAX_MAP_OBJECTS];
  66.  
  67. CreateMap()
  68. {
  69.  
  70. Object[0] = CreateObject(6982,-2384.3571800,1849.5330800,13.1090400,0.0000000,0.0000400,0.0000000); //
  71. Object[1] = CreateObject(6983,-2317.2873500,1764.9034400,10.0500700,0.0000000,0.0000400,0.0000000); //
  72. Object[2] = CreateObject(7357,-2331.8857400,1929.8802500,16.1359300,0.0000000,0.0000400,0.0000000); //
  73. Object[3] = CreateObject(6915,-2410.1335400,2018.8156700,19.5188200,0.0000000,0.0000400,0.0000000); //
  74. Object[4] = CreateObject(4112,-2393.7639200,1954.9863300,28.9981900,0.0000000,0.0000000,0.0000000); //
  75. Object[5] = CreateObject(4112,-2421.5026900,1957.1076700,28.9981900,0.0000000,0.0000000,0.0000000); //
  76. Object[6] = CreateObject(4594,-2409.4860800,1903.0615200,19.2708000,0.0000000,0.0000000,-90.0599900); //
  77. Object[7] = CreateObject(4594,-2379.0681200,2001.4565400,17.9344600,0.0000000,0.0000000,-90.0599900); //
  78. Object[8] = CreateObject(972,-2187.3190900,1650.6822500,10.4114200,0.0000000,0.0000000,113.8800700); //
  79. Object[9] = CreateObject(6984,-2234.7304700,1693.1379400,11.3096200,0.0000000,0.0000000,0.0000000); //
  80. }
  81. #endif
  82.  
  83.  
  84. //==============================================================================
  85. // Basic vars
  86. //==============================================================================
  87.  
  88. new bool:MissionStarted;
  89. new bool:ObjectiveStarted;
  90. new bool:MissionCancelled;
  91.  
  92. new bool:ObjectiveStolen;
  93. new ObjectiveStolenBy;
  94.  
  95. native IsValidVehicle(vehicleid);
  96.  
  97. enum obj
  98. {
  99. ObjectiveVeh,
  100. ObjectiveName[30],
  101. ObjectiveMarker,
  102. Float:ObjectiveEndX,
  103. Float:ObjectiveEndY,
  104. Float:ObjectiveEndZ
  105. };
  106.  
  107. enum teamdata
  108. {
  109. Name[32],
  110. Members,
  111. Kills
  112. };
  113.  
  114. enum playerdata
  115. {
  116. UserName[MAX_PLAYER_NAME],
  117. bool:TeamChosen,
  118. TeamSelection,
  119. PlayerClassID
  120. };
  121. new Team[2][teamdata];
  122. new PlayerMissionInfo[MAX_PLAYERS][playerdata];
  123. new ObjectiveInfo[obj];
  124.  
  125. //==============================================================================
  126. // Basic script
  127. //==============================================================================
  128.  
  129. main()
  130. {
  131. print("----------------------------------");
  132. print(" Mission: "MISSION_NAME" started.");
  133. print("----------------------------------\n");
  134. }
  135.  
  136. public OnGameModeInit()
  137. {
  138.  
  139. AddStaticVehicleEx(468,-2411.0889000,1977.3751000,18.3254000,-174.8400000,-1,-1,15); //Sanchez
  140. AddStaticVehicleEx(468,-2411.1375000,1980.0914000,18.3991000,-174.8400000,-1,-1,15); //Sanchez
  141. AddStaticVehicleEx(468,-2411.2300000,1982.9172000,18.5653000,-174.8400000,-1,-1,15); //Sanchez
  142. AddStaticVehicleEx(468,-2411.2952000,1985.7749000,18.7043000,-174.8400000,-1,-1,15); //Sanchez
  143. AddStaticVehicleEx(468,-2410.9011000,1974.6755000,18.3254000,-174.8400000,-1,-1,15); //Sanchez
  144. AddStaticVehicleEx(468,-2411.2349000,1988.2758000,18.7796000,-174.8400000,-1,-1,15); //Sanchez
  145. AddStaticVehicleEx(468,-2405.8425000,1974.5273000,18.3479000,-174.8400000,-1,-1,15); //Sanchez
  146. AddStaticVehicleEx(468,-2405.9063000,1977.5974000,18.3254000,-174.8400000,-1,-1,15); //Sanchez
  147. AddStaticVehicleEx(468,-2405.8535000,1981.0378000,18.3991000,-174.8400000,-1,-1,15); //Sanchez
  148. AddStaticVehicleEx(468,-2405.9844000,1984.3181000,18.5653000,-174.8400000,-1,-1,15); //Sanchez
  149. AddStaticVehicleEx(468,-2405.7859000,1988.1534000,18.7796000,-174.8400000,-1,-1,15); //Sanchez
  150. AddStaticVehicleEx(468,-2405.9055000,1971.7267000,18.3479000,-174.8400000,-1,-1,15); //Sanchez
  151. AddStaticVehicleEx(468,-2410.7207000,1971.7883000,18.3479000,-174.8400000,-1,-1,15); //Sanchez
  152. MissionStarted= true;
  153. format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
  154. format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
  155.  
  156. format(ObjectiveInfo[ObjectiveName],sizeof(ObjectiveInfo[ObjectiveName]),"%s",OBJ_NAME);
  157.  
  158. ObjectiveInfo[ObjectiveVeh] = CreateVehicle(OBJ_ID,OBJ_POS,random(225),random(225),3);
  159. SetVehicleHealth(ObjectiveInfo[ObjectiveVeh],1100);
  160.  
  161. new iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective;
  162. GetVehicleParamsEx(ObjectiveInfo[ObjectiveVeh], iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
  163. SetVehicleParamsEx(ObjectiveInfo[ObjectiveVeh], iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, 1);
  164.  
  165. for(new i=0; i<sizeof(SkinData); i++)
  166. {
  167. 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);
  168. }
  169.  
  170. for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
  171.  
  172. for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
  173.  
  174. if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
  175. SetTimer("StartMissionFunc",3000,false);
  176. return 1;
  177. }
  178.  
  179. FUNCTION StartMissionFunc()
  180. {
  181. CallRemoteFunction("StartMission","");
  182. ObjectiveStarted= true;
  183. return 1;
  184. }
  185.  
  186. public OnGameModeExit()
  187. {
  188. #if MAX_MAP_OBJECTS != 0
  189. for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
  190. #endif
  191. for(new i=0; i<MAX_VEHICLES; i++)
  192. {
  193. DestroyVehicle(i);
  194. }
  195. return 1;
  196. }
  197.  
  198. public OnPlayerDisconnect(playerid)
  199. {
  200. if(PlayerMissionInfo[playerid][TeamChosen] && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM)
  201. {
  202. Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
  203. PlayerMissionInfo[playerid][TeamChosen]=false;
  204. }
  205. return 1;
  206. }
  207.  
  208. public OnPlayerRequestClass(playerid,classid)
  209. {
  210. SetPlayerPos(playerid,CLASS_POSTION);
  211. SetPlayerCameraPos(playerid,CLASS_CAMERA);
  212. SetPlayerCameraLookAt(playerid,CLASS_POSTION);
  213. SetPlayerFacingAngle(playerid,CLASS_FACING_AGNLE);
  214.  
  215. CallRemoteFunction("ShowClassSelection","iisiii",playerid, SkinData[classid][TeamID],Team[SkinData[classid][TeamID]][Name], SkinData[classid][Weapon1], SkinData[classid][Weapon2], SkinData[classid][Weapon3]);
  216.  
  217. if(PlayerMissionInfo[playerid][TeamChosen])
  218. {
  219. PlayerMissionInfo[playerid][TeamChosen] = false;
  220. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
  221. }
  222.  
  223. PlayerMissionInfo[playerid][TeamSelection] = SkinData[classid][TeamID];
  224. PlayerMissionInfo[playerid][PlayerClassID]=classid;
  225. return 1;
  226. }
  227.  
  228. public OnPlayerRequestSpawn(playerid)
  229. {
  230. new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
  231. if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
  232. {
  233. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This Team is full, choose another!",0);
  234. return 0;
  235. }
  236. return 1;
  237. }
  238.  
  239.  
  240.  
  241. public OnPlayerSpawn(playerid)
  242. {
  243. SetPlayerHealth(playerid,Health);
  244. new string[124];
  245. CallRemoteFunction("UpdateAliveState","ii",playerid,1);
  246. if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
  247. if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
  248. else
  249. {
  250. SetPlayerPos(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
  251. SetPlayerInterior(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
  252. SetPlayerFacingAngle(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
  253. SetPlayerVirtualWorld(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
  254. if(!PlayerMissionInfo[playerid][TeamChosen])
  255. {
  256. Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
  257. PlayerMissionInfo[playerid][TeamChosen] = true;
  258. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  259. {
  260. format(string,sizeof(string),"You are a %s, your mission is to steal the %s.",Team[TEAM_ATTACK][Name],ObjectiveInfo[ObjectiveName]);
  261. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  262. format(string,sizeof(string),"%s will try to stop you, eliminate them!.",Team[TEAM_DEFEND][Name]);
  263. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string,4000);
  264. format(string,sizeof(string),"Steal the ~y~%s~w~!",ObjectiveInfo[ObjectiveName]);
  265. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  266. }
  267. else
  268. {
  269. 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]);
  270. CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
  271. format(string,sizeof(string),"Protect the ~y~%s~w~!.",ObjectiveInfo[ObjectiveName]);
  272. CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
  273. }
  274. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
  275. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
  276. CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
  277. }
  278. }
  279. SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
  280. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
  281. else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
  282. #if SPAWN_PROTECTION == true
  283. CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
  284. #endif
  285.  
  286. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_DEFEND) SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],playerid,1,1);
  287. else SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],playerid,1,0);
  288. return 1;
  289. }
  290.  
  291. public OnPlayerDeath(playerid, killerid, reason)
  292. {
  293. if(killerid != INVALID_PLAYER_ID)
  294. {
  295. SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
  296. Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
  297. }
  298. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  299. {
  300. if(GetPlayerVehicleID(playerid) == ObjectiveInfo[ObjectiveVeh])
  301. {
  302. new string[124];
  303. format(string,sizeof(string),"%s has died and left the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  304. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  305. DisablePlayerRaceCheckpoint(playerid);
  306. }
  307. }
  308. CallRemoteFunction("UpdateAliveState","ii",playerid,0);
  309. return 1;
  310. }
  311.  
  312. public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
  313. {
  314. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  315. {
  316. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  317. {
  318. new string[124];
  319. format(string,sizeof(string),"%s is stealing the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  320. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  321. SetPlayerCheckpoint(playerid,CP_POS,10.0);
  322. }
  323. }
  324. else
  325. {
  326. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  327. {
  328. new Float:x,Float:y,Float:z;
  329. GetPlayerPos(playerid,x,y,z);
  330. SetPlayerPos(playerid,x,y,z+3);
  331. ClearAnimations(playerid);
  332. }
  333. }
  334. return 1;
  335. }
  336.  
  337. public OnPlayerExitVehicle(playerid, vehicleid)
  338. {
  339. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  340. {
  341. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  342. {
  343. new string[124];
  344. format(string,sizeof(string),"%s has left the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  345. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  346. DisablePlayerCheckpoint(playerid);
  347. }
  348. }
  349. }
  350.  
  351. public OnPlayerEnterCheckpoint(playerid)
  352. {
  353. if(!MissionStarted || ObjectiveStolen) return 1;
  354. if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
  355. {
  356. if(GetPlayerVehicleID(playerid) == ObjectiveInfo[ObjectiveVeh])
  357. {
  358. new string[124];
  359. format(string,sizeof(string),"%s has stolen the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
  360. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
  361. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++) if(IsPlayerConnected(i)) DisablePlayerCheckpoint(i);
  362. DestroyVehicle(ObjectiveInfo[ObjectiveVeh]);
  363. ObjectiveStolen= true;
  364. ObjectiveStolenBy=playerid;
  365. CallRemoteFunction("EndMission","");
  366. PlayerPlaySound(playerid,1097,0,0,0);
  367. }
  368. }
  369. return 1;
  370. }
  371.  
  372.  
  373.  
  374. public OnVehicleStreamIn(vehicleid, forplayerid)
  375. {
  376. if(vehicleid == ObjectiveInfo[ObjectiveVeh])
  377. {
  378.  
  379. if(PlayerMissionInfo[forplayerid][TeamSelection] == TEAM_DEFEND) SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],forplayerid,1,1);
  380. else SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],forplayerid,1,0);
  381. }
  382. return 1;
  383. }
  384.  
  385. public OnVehicleSpawn(vehicleid)
  386. {
  387. SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
  388. if(vehicleid == ObjectiveInfo[ObjectiveVeh]) SetVehicleHealth(ObjectiveInfo[ObjectiveVeh],VEHICLE_HEALTH + (100*Team[TEAM_DEFEND][Members]));
  389. return 1;
  390. }
  391.  
  392.  
  393. FUNCTION EndTheMission()
  394. {
  395. if(!MissionStarted) return 1;
  396. MissionStarted= false;
  397. if(!MissionCancelled)
  398. {
  399. new string[128];
  400. new amount= 10000;
  401. if(!ObjectiveStolen)
  402. {
  403. amount+=Team[TEAM_DEFEND][Kills]*100;
  404. 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);
  405. SendClientMessageToAll(COLOR_SERVER,string);
  406. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  407. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  408. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  409. {
  410. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  411. if(PlayerMissionInfo[i][TeamSelection] == TEAM_DEFEND)
  412. {
  413. PlayerPlaySound(i,3200,0,0,0);
  414. SendClientMessage(i,COLOR_TEAM_DEFEND,string);
  415. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  416. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  417. }
  418. if(PlayerMissionInfo[i][TeamSelection] != TEAM_DEFEND)
  419. {
  420. PlayerPlaySound(i,17004,0,0,0);
  421. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  422. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  423. }
  424. }
  425. }
  426. else
  427. {
  428. amount+=Team[TEAM_ATTACK][Kills]*100;
  429. 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);
  430. SendClientMessageToAll(COLOR_SERVER,string);
  431. CallRemoteFunction("PlayerMissionStats","dd",ObjectiveStolenBy,7);
  432. CallRemoteFunction("GivePlayerToken","dd",ObjectiveStolenBy,1);
  433. CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
  434. format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
  435. for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
  436. {
  437. if(!PlayerMissionInfo[i][TeamChosen]) continue;
  438. if(PlayerMissionInfo[i][TeamSelection] == TEAM_ATTACK)
  439. {
  440. PlayerPlaySound(i,3200,0,0,0);
  441. SendClientMessage(i,COLOR_TEAM_ATTACK,string);
  442. CallRemoteFunction("GivePlayerCash","ii",i,amount);
  443. CallRemoteFunction("PlayerMissionStats","dd",i,0);
  444. }
  445. if(PlayerMissionInfo[i][TeamSelection] != TEAM_ATTACK)
  446. {
  447. PlayerPlaySound(i,17004,0,0,0);
  448. GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
  449. CallRemoteFunction("PlayerMissionStats","dd",i,1);
  450. }
  451. }
  452. }
  453. }
  454. else
  455. {
  456. PlaySoundForAll(1058);
  457. SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
  458. CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
  459. CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
  460. GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
  461. }
  462. return 1;
  463. }
  464.  
  465. //==============================================================================
  466. // Mission functions
  467. //==============================================================================
  468.  
  469. PlaySoundForAll(sound)
  470. {
  471. for (new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
  472. {
  473. if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
  474. }
  475. }
  476.  
  477. //==============================================================================
  478. // Important functions required
  479. //==============================================================================
  480.  
  481. FUNCTION OnPlayerNameRecieve(playerid,name[])
  482. {
  483. format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
  484. return 1;
  485. }
  486.  
  487. FUNCTION CancelTheMission()
  488. {
  489. MissionCancelled= true;
  490. return 1;
  491. }
  492.  
  493. FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
Add Comment
Please, Sign In to add comment