Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Script by: Bullet
- Map by: MiD
- Mission Base: Bombing
- Mission Type: Checkpoint bombing
- Mission Type ID: 1
- */
- //==============================================================================
- // Includes
- //==============================================================================
- #include <a_samp>
- #include <crashdetect>
- #include <float>
- #include "..\filterscripts\MM\stuff\defines"
- #include "..\filterscripts\MM\stuff\serverkeymsg"
- //==============================================================================
- // Defines
- //==============================================================================
- #define MISSION_NAME "Drugs on Fire"
- #define Health 99.0
- #define OBJ_NAME "Drug Factory"
- #define CP_POS -2145.6235,-253.9246,40.71
- #define CP_SIZE 3.0
- #define VEHICLE_HEALTH 999.0
- #define CLASS_POSTION -2175.7952,-231.4047,36.5156
- #define CLASS_CAMERA -2181.8398,-230.1611,36.5156
- #define CLASS_FACING_AGNLE 80.2331
- #define TEAM_DEFEND_NAME "Mafia"
- #define TEAM_ATTACK_NAME "Police"
- #define MAX_MAP_OBJECTS 25
- #define PLACING_TIME 7
- #define SPAWN_PROTECTION true
- //==============================================================================
- // Per mission functions
- //==============================================================================
- enum skindata
- {
- TeamID,
- SkinID,
- Float:SpawnX,
- Float:SpawnY,
- Float:SpawnZ,
- Float:SpawnAngle,
- SpawnInterior,
- VirtualWorld,
- Weapon1,
- Ammo1,
- Weapon2,
- Ammo2,
- Weapon3,
- Ammo3,
- };
- new const SkinData[][skindata] = {
- {TEAM_ATTACK, 281, -1968.8245,132.1389,27.6875,85.1686,0,0,WEAPON_AK47,280,WEAPON_DEAGLE,80,WEAPON_GRENADE,4},
- {TEAM_DEFEND, 124,-2104.4385,-209.3291,35.3203,88.8383,0,0,WEAPON_UZI,210,WEAPON_DEAGLE,80,WEAPON_GRENADE,4},
- {TEAM_ATTACK, 285, -1982.3809,145.3371,27.6875,92.3754,0,0,WEAPON_MP5,280,WEAPON_SHOTGUN,60,WEAPON_NITESTICK,1},
- {TEAM_DEFEND, 127,-2139.7466,-149.0962,36.5049,88.5249,0,0,WEAPON_AK47,280,WEAPON_TEC9,460,WEAPON_COLT45,100}
- };
- new const Float:ExplosionsInfo[][3] = {
- {2463.1211,-1666.8960,13.4766},
- {-2188.9060,-255.0842,42.0237},
- {-2155.7180,-263.3134,46.3872},
- {-2150.1221,-254.0361,46.7895},
- {-2157.1211,-226.5739,36.5220},
- {-2161.6814,-237.6113,36.5156},
- {-2171.2822,-236.9347,36.5156},
- {-2176.3674,-238.9926,36.5220},
- {-2167.3220,-226.4747,44.9798},
- {-2177.0344,-219.0716,42.0465},
- {-2183.0071,-205.9743,36.5156},
- {-2189.6252,-212.8108,36.5156},
- {-2188.7437,-236.2425,38.2537},
- {-2142.8762,-238.3528,36.5156},
- {-2139.3860,-239.9258,40.4382},
- {-2143.7202,-226.9313,36.5156},
- {-2159.0354,-247.5820,36.5156},
- {-2168.2815,-248.9831,36.5156},
- {-2160.4912,-265.4875,36.5156},
- {-2147.0493,-256.4703,36.5156},
- {-2139.8860,-257.0020,36.5156},
- {-2139.9958,-266.9616,36.5156},
- {-2173.4524,-259.3654,45.7206},
- {-2180.5532,-263.2342,46.1229}
- };
- #if MAX_MAP_OBJECTS != 0
- new Object[MAX_MAP_OBJECTS];
- CreateMap()
- {
- AddStaticVehicle(469,-2155.0896,-182.9428,41.1414,359.5534,75,2); // Seasprrow
- AddStaticVehicle(459,-2114.1033,-273.2192,35.3746,356.1795,57,57); // vehicle
- AddStaticVehicle(459,-2109.4753,-273.4923,35.3717,356.4679,51,51); // vehicle
- AddStaticVehicle(459,-2105.0156,-273.7660,35.3747,357.7630,44,44); // vehicle
- AddStaticVehicle(459,-2100.6897,-274.1206,35.3780,359.9228,28,28); // vehicle
- AddStaticVehicle(459,-2173.0427,-214.9930,35.3745,267.9830,106,106); // vehicle
- AddStaticVehicle(459,-2173.1787,-220.1465,35.3811,269.1607,72,72); // vehicle
- AddStaticVehicle(515,-2104.1182,-200.1182,36.3352,89.1038,24,77); // vehicl
- AddStaticVehicle(415,-2132.4341,-114.3199,35.0958,179.4082,25,1); // veh
- AddStaticVehicle(415,-2129.0193,-114.3530,35.4746,179.4082,25,1); // veh
- AddStaticVehicle(415,-2124.7090,-114.3953,35.8579,179.4082,25,1); // veh
- AddStaticVehicle(415,-2120.3147,-114.4386,36.2303,179.4082,25,1); // veh
- AddStaticVehicle(415,-2115.7393,-114.4850,36.3720,179.4082,25,1); // veh
- AddStaticVehicle(515,-2102.5945,-88.8966,36.3471,90.8843,63,78); // veh
- AddStaticVehicle(429,-2022.3447,-98.4749,34.8437,359.3260,13,13); // veh
- AddStaticVehicle(459,-2150.2522,-146.5753,36.5102,359.6807,112,112); // car
- AddStaticVehicle(597,-1993.2491,98.7554,27.3763,90.5661,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.0876,110.7273,27.3814,179.6695,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.0673,118.4010,27.3780,180.4700,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.1235,125.5648,27.3811,180.4953,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.1433,133.0636,27.3806,180.0091,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.2098,140.3433,27.3803,180.5386,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.1925,148.1132,27.3804,180.5220,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.2200,155.0967,27.3803,180.1163,0,1); // VEHICLECOP
- AddStaticVehicle(597,-1987.2388,162.4059,27.3818,180.3669,0,1); // VEHICLECOP
- AddStaticVehicle(528,-1992.7528,197.4871,27.6491,90.5871,0,0); // VEHICLECOP
- AddStaticVehicle(415,-1987.2097,177.7588,27.3810,359.8402,62,1); // VEHICLECOP
- AddStaticVehicle(415,-1987.2341,188.1376,27.3794,0.1473,62,1); // VEHICLECOP
- Object[0] = CreateObject(944,-2162.8798828,-227.0681610,36.4004135,0.0000000,0.0000000,272.0000000); //object(packing_carates04)(1)
- Object[1] = CreateObject(971,-2135.4816890,-154.1937410,37.8901670,0.0000000,0.0000000,-56.2500170); //object
- Object[2] = CreateObject(971,-2131.3188480,-161.9702450,37.8901670,0.0000000,0.0000000,-67.4999860); //object(1)
- Object[3] = CreateObject(971,-2128.9094240,-170.3375240,37.9651870,0.0000000,0.0000000,-78.7500123); //object(2)
- Object[4] = CreateObject(971,-2127.5214840,-179.0550840,37.9152300,0.0000000,0.0000000,-83.9839244); //object(3)
- Object[5] = CreateObject(1271,-2180.6364750,-207.3528290,35.8656230,0.0000000,0.0000000,0.0000000); //object(7)
- Object[6] = CreateObject(1271,-2180.6521000,-208.1038820,35.8656230,0.0000000,0.0000000,0.0000000); //object(8)
- Object[7] = CreateObject(1271,-2180.6682130,-208.8349760,35.8656230,0.0000000,0.0000000,0.0000000); //object(9)
- Object[8] = CreateObject(1271,-2180.6503910,-209.5831760,35.8656230,0.0000000,0.0000000,0.0000000); //object(10)
- Object[9] = CreateObject(1271,-2180.6525880,-210.3245850,35.8656230,0.0000000,0.0000000,0.0000000); //object(11)
- Object[10] = CreateObject(1271,-2180.6550290,-211.0502620,35.8656230,0.0000000,0.0000000,0.0000000); //object(12)
- Object[11] = CreateObject(1271,-2180.6828610,-211.7620540,35.8656230,0.0000000,0.0000000,0.0000000); //object(13)
- Object[12] = CreateObject(1271,-2180.6379390,-207.3715520,36.5565910,0.0000000,0.0000000,0.0000000); //object(14)
- Object[13] = CreateObject(1271,-2180.6586910,-208.1345370,36.5565910,0.0000000,0.0000000,0.0000000); //object(15)
- Object[14] = CreateObject(1271,-2180.6762700,-208.8878780,36.5565910,0.0000000,0.0000000,0.0000000); //object(16)
- Object[15] = CreateObject(1271,-2180.6958010,-209.6635130,36.5565910,0.0000000,0.0000000,0.0000000); //object(17)
- Object[16] = CreateObject(1271,-2180.6857910,-210.4110570,36.5565910,0.0000000,0.0000000,0.0000000); //object(18)
- Object[17] = CreateObject(1271,-2180.6452640,-211.1673580,36.5455360,0.0000000,0.0000000,0.0000000); //object(19)
- Object[18] = CreateObject(1271,-2180.6599120,-208.1043850,37.2475590,0.0000000,0.0000000,0.0000000); //object(20)
- Object[19] = CreateObject(1271,-2180.6657710,-208.9075930,37.2475590,0.0000000,0.0000000,0.0000000); //object(21)
- Object[20] = CreateObject(1271,-2180.6560060,-209.6454620,37.2475590,0.0000000,0.0000000,0.0000000); //object(22)
- Object[21] = CreateObject(1271,-2180.6809080,-210.4202730,37.2475590,0.0000000,0.0000000,0.0000000); //object(23)
- Object[22] = CreateObject(1271,-2180.6552730,-211.1438290,37.2365040,0.0000000,0.0000000,0.0000000); //object(24)
- Object[23] = CreateObject(1271,-2180.6992190,-208.8907010,37.9385260,0.0000000,0.0000000,0.0000000); //object(25)
- Object[24] = CreateObject(1271,-2180.6992190,-210.4153290,37.9385260,0.0000000,0.0000000,0.0000000); //object(26)
- }
- #endif
- //==============================================================================
- // Basic vars
- //==============================================================================
- new bool:MissionStarted;
- new bool:ObjectiveStarted;
- new bool:MissionCancelled;
- new bool:ObjectivePlaced;
- native IsValidVehicle(vehicleid);
- enum obj
- {
- ObjectiveName[30],
- BeingPlaced,
- ObjectiveTimer,
- ProgressTimer,
- ProgressCount,
- Count
- };
- enum teamdata
- {
- Name[32],
- Members,
- Kills
- };
- enum playerdata
- {
- UserName[MAX_PLAYER_NAME],
- bool:TeamChosen,
- TeamSelection,
- PlayerClassID
- };
- new Team[2][teamdata];
- new PlayerMissionInfo[MAX_PLAYERS][playerdata];
- new ObjectiveInfo[obj];
- new MaxExplosions;
- new FlashTimer;
- //==============================================================================
- // Basic script
- //==============================================================================
- main()
- {
- print("----------------------------------");
- print(" Mission: "MISSION_NAME" started.");
- print("----------------------------------\n");
- }
- public OnGameModeInit()
- {
- MissionStarted= true;
- format(Team[TEAM_DEFEND][Name],32,"%s",TEAM_DEFEND_NAME);
- format(Team[TEAM_ATTACK][Name],32,"%s",TEAM_ATTACK_NAME);
- format(ObjectiveInfo[ObjectiveName],sizeof(ObjectiveInfo[ObjectiveName]),"%s",OBJ_NAME);
- CallRemoteFunction("CreateBombingTD","d",PLACING_TIME*10);
- MaxExplosions= sizeof(ExplosionsInfo);
- ObjectivePlaced= false;
- ObjectiveInfo[BeingPlaced]=-1;
- #if MAX_MAP_OBJECTS != 0
- CreateMap();
- #endif
- for(new i=0; i<sizeof(SkinData); i++)
- {
- 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);
- }
- for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
- for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
- if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
- SetTimer("StartMissionFunc",3000,false);
- return 1;
- }
- FUNCTION StartMissionFunc()
- {
- CallRemoteFunction("StartMission","");
- ObjectiveStarted= true;
- return 1;
- }
- public OnGameModeExit()
- {
- #if MAX_MAP_OBJECTS != 0
- for(new i=0;i<MAX_MAP_OBJECTS;i++) DestroyObject(Object[i]);
- #endif
- for(new i=0; i<MAX_VEHICLES; i++)
- {
- DestroyVehicle(i);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- if(PlayerMissionInfo[playerid][TeamChosen])
- {
- Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
- PlayerMissionInfo[playerid][TeamChosen]=false;
- }
- return 1;
- }
- public OnPlayerRequestClass(playerid,classid)
- {
- SetPlayerPos(playerid,CLASS_POSTION);
- SetPlayerCameraPos(playerid,CLASS_CAMERA);
- SetPlayerCameraLookAt(playerid,CLASS_POSTION);
- SetPlayerFacingAngle(playerid,CLASS_FACING_AGNLE);
- CallRemoteFunction("ShowClassSelection","iisiii",playerid, SkinData[classid][TeamID],Team[SkinData[classid][TeamID]][Name], SkinData[classid][Weapon1], SkinData[classid][Weapon2], SkinData[classid][Weapon3]);
- if(PlayerMissionInfo[playerid][TeamChosen])
- {
- PlayerMissionInfo[playerid][TeamChosen] = false;
- Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
- }
- PlayerMissionInfo[playerid][TeamSelection] = SkinData[classid][TeamID];
- PlayerMissionInfo[playerid][PlayerClassID]=classid;
- return 1;
- }
- public OnPlayerRequestSpawn(playerid)
- {
- new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
- if(Team[PlayerMissionInfo[playerid][TeamSelection]][Members] > Team[opp_team][Members])
- {
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This Team is full, choose another!",0);
- return 0;
- }
- return 1;
- }
- public OnPlayerSpawn(playerid)
- {
- new string[124];
- CallRemoteFunction("UpdateAliveState","ii",playerid,1);
- if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
- if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
- else
- {
- SetPlayerPos(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
- SetPlayerInterior(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
- SetPlayerFacingAngle(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
- SetPlayerVirtualWorld(playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
- if(!PlayerMissionInfo[playerid][TeamChosen])
- {
- Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
- PlayerMissionInfo[playerid][TeamChosen] = true;
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
- {
- format(string,sizeof(string),"You are a %s, your mission is to destroy the %s.",Team[TEAM_ATTACK][Name],ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
- format(string,sizeof(string),"%s will try to stop you, eliminate them!.",Team[TEAM_DEFEND][Name]);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string,4000);
- format(string,sizeof(string),"Destroy the ~y~%s~w~!",ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
- }
- else
- {
- 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]);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,2000);
- format(string,sizeof(string),"Protect the ~y~%s~w~!.",ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoText", "iisi", playerid, -1, string,1000);
- }
- }
- CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
- CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
- CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],SkinData[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
- }
- SetPlayerTeam(playerid,PlayerMissionInfo[playerid][TeamSelection]);
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) SetPlayerColor(playerid,COLOR_TEAM_ATTACK);
- else SetPlayerColor(playerid,COLOR_TEAM_DEFEND);
- SetPlayerHealth(playerid,Health);
- #if SPAWN_PROTECTION == true
- CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
- #endif
- CallRemoteFunction("OnPlayerBombingData", "ii", playerid, 1);
- SetPlayerCheckpoint(playerid,CP_POS,CP_SIZE);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- new string[128];
- if(killerid != INVALID_PLAYER_ID)
- {
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
- }
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
- {
- if(!ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
- {
- ObjectiveInfo[BeingPlaced]=-1;
- format(string,sizeof(string),"~y~%s ~w~has died while ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName]);
- CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
- ObjectiveInfo[Count]=0;
- KillTimer(ObjectiveInfo[ObjectiveTimer]);
- ObjectiveInfo[ProgressCount]=0;
- KillTimer(ObjectiveInfo[ProgressTimer]);
- CallRemoteFunction("UpdateBombProgressBar", "d", 0);
- }
- }
- CallRemoteFunction("UpdateAliveState","ii",playerid,0);
- return 1;
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(!MissionStarted || ObjectivePlaced) return 1;
- new string[128];
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced)
- {
- if(ObjectiveInfo[BeingPlaced] != -1)
- {
- format(string,sizeof(string),"%s is already trying to place the bomb. Please wait!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
- }
- else
- {
- ObjectiveInfo[BeingPlaced]=playerid;
- format(string,sizeof(string),"~y~%s~w~ is placing the bomb..!!",PlayerMissionInfo[playerid][UserName],playerid);
- CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
- format(string,sizeof(string),"Wait in the checkpoint for %d seconds to place the bomb.",PLACING_TIME);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
- ObjectiveInfo[Count]=0;
- ObjectiveInfo[ProgressCount]=0;
- CallRemoteFunction("UpdateBombProgressBar", "d", 0);
- ObjectiveInfo[ObjectiveTimer] = SetTimer("PlacingTimer",1000,true);
- ObjectiveInfo[ProgressTimer] = SetTimer("ProgressFillUP",100,true);
- }
- }
- else
- {
- if(ObjectiveInfo[BeingPlaced] != -1)
- {
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, "This is bomb placing sight, protect it.", 0);
- }
- else
- {
- format(string,sizeof(string),"%s is trying to place the bomb. Stop them!",PlayerMissionInfo[ObjectiveInfo[BeingPlaced]][UserName]);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1, string, 0);
- }
- }
- return 1;
- }
- public OnPlayerLeaveCheckpoint(playerid)
- {
- if(!MissionStarted || ObjectivePlaced) return 1;
- new string[128];
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK && !ObjectivePlaced && ObjectiveInfo[BeingPlaced] == playerid)
- {
- ObjectiveInfo[BeingPlaced]=-1;
- format(string,sizeof(string),"~y~%s~w~ has left ~r~~h~planting~w~ the bomb.",PlayerMissionInfo[playerid][UserName],playerid);
- CallRemoteFunction("ShowInfoText", "iisi", -1, playerid, string, 0);
- ObjectiveInfo[Count]=0;
- KillTimer(ObjectiveInfo[ObjectiveTimer]);
- ObjectiveInfo[ProgressCount]=0;
- KillTimer(ObjectiveInfo[ProgressTimer]);
- CallRemoteFunction("UpdateBombProgressBar", "d", 0);
- }
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
- return 1;
- }
- FUNCTION EndTheMission()
- {
- if(!MissionStarted) return 1;
- MissionStarted= false;
- if(!MissionCancelled)
- {
- new string[256];
- new amount= 10000;
- if(!ObjectivePlaced)
- {
- amount+=Team[TEAM_DEFEND][Kills]*100;
- 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);
- SendClientMessageToAll(COLOR_SERVER,string);
- CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
- format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the mission!",amount);
- for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
- {
- if(!PlayerMissionInfo[i][TeamChosen]) continue;
- if(PlayerMissionInfo[i][TeamSelection] == TEAM_DEFEND)
- {
- PlayerPlaySound(i,3200,0,0,0);
- SendClientMessage(i,COLOR_TEAM_DEFEND,string);
- CallRemoteFunction("GivePlayerCash","ii",i,amount);
- CallRemoteFunction("PlayerMissionStats","dd",i,0);
- }
- if(PlayerMissionInfo[i][TeamSelection] != TEAM_DEFEND)
- {
- PlayerPlaySound(i,17004,0,0,0);
- GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
- CallRemoteFunction("PlayerMissionStats","dd",i,1);
- }
- }
- }
- else
- {
- amount+=Team[TEAM_ATTACK][Kills]*100;
- 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]);
- SendClientMessageToAll(COLOR_SERVER,string);
- format(string,sizeof(string),""SERVER_KEY_MSG" %s have won the mission. Reward: $%d.",Team[TEAM_ATTACK][Name],amount);
- SendClientMessageToAll(COLOR_SERVER,string);
- CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
- CallRemoteFunction("PlayerMissionStats","dd",ObjectiveInfo[BeingPlaced],8);
- CallRemoteFunction("GivePlayerToken","dd",ObjectiveInfo[BeingPlaced],1);
- format(string,sizeof(string),""SERVER_KEY_MSG" You have received $%i because your team has won the Team-Deathmatch!",amount);
- for(new i=0,j=GetPlayerPoolSize(); i <= j; i++)
- {
- if(!PlayerMissionInfo[i][TeamChosen]) continue;
- if(PlayerMissionInfo[i][TeamSelection] == TEAM_ATTACK)
- {
- PlayerPlaySound(i,3200,0,0,0);
- SendClientMessage(i,COLOR_TEAM_ATTACK,string);
- CallRemoteFunction("GivePlayerCash","ii",i,amount);
- CallRemoteFunction("PlayerMissionStats","dd",i,0);
- }
- if(PlayerMissionInfo[i][TeamSelection] != TEAM_ATTACK)
- {
- PlayerPlaySound(i,17004,0,0,0);
- GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
- CallRemoteFunction("PlayerMissionStats","dd",i,1);
- }
- }
- }
- }
- else
- {
- PlaySoundForAll(1058);
- SendClientMessageToAll(COLOR_SERVER,""SERVER_KEY_MSG" The mission has been cancelled.");
- CallRemoteFunction("IRC_SendMessage","ss",""SERVER_KEY_MSG" The mission has been cancelled.",IRC_SERVER_COLOR);
- CallRemoteFunction("ShowInfoBox", "iisi", -1, -1,"The mission has been cancelled.",0);
- GameTextForAll("~R~MISSION CANCELLED~w~!",3000,3);
- }
- return 1;
- }
- //==============================================================================
- // Mission functions
- //==============================================================================
- FUNCTION ProgressFillUP()
- {
- ObjectiveInfo[ProgressCount]++;
- CallRemoteFunction("UpdateBombProgressBar", "d", ObjectiveInfo[ProgressCount]);
- }
- FUNCTION PlacingTimer()
- {
- if(!MissionStarted || ObjectivePlaced) return 1;
- if(ObjectiveInfo[BeingPlaced] == -1)
- {
- ObjectiveInfo[Count]=0;
- ObjectiveInfo[ProgressCount]=0;
- KillTimer(ObjectiveInfo[ObjectiveTimer]);
- KillTimer(ObjectiveInfo[ProgressTimer]);
- }
- ObjectiveInfo[Count]++;
- if(ObjectiveInfo[Count] == PLACING_TIME)
- {
- ObjectivePlaced=true;
- new string[128],id=ObjectiveInfo[BeingPlaced];
- format(string,sizeof(string),""SERVER_KEY_MSG" %s (%d) has successfully planted the bomb, 15 seconds before the bomb explodes.",PlayerMissionInfo[id][UserName],id);
- SendClientMessageToAll(COLOR_SERVER,string);
- SetTimerEx("Explosion",15000,false,"ii",0,5);
- KillTimer(ObjectiveInfo[ObjectiveTimer]);
- KillTimer(ObjectiveInfo[ProgressTimer]);
- FlashTimer= SetTimer("FlasBomb",500,true);
- CallRemoteFunction("FlashBombBar", "");
- CallRemoteFunction("UpdateBombInfo", "");
- CallRemoteFunction("KillGameModeTimer","");
- CallRemoteFunction("TD_Clock","s","_");
- DisableCheckpointForAll();
- }
- return 1;
- }
- FUNCTION FlasBomb()
- {
- CallRemoteFunction("FlashBombBar", "");
- return 1;
- }
- FUNCTION Explosion(start, until)
- {
- for(new i = start; i < until; i++)
- {
- if(i >= MaxExplosions) break;
- CreateExplosion(ExplosionsInfo[i][0], ExplosionsInfo[i][1], ExplosionsInfo[i][2] , 7, 20.0);
- }
- start += 5;
- until += 5;
- if(until > MaxExplosions)
- {
- CallRemoteFunction("EndMission","");
- KillTimer(FlashTimer);
- }
- else
- {
- SetTimerEx("Explosion", 1000, false, "ii", start, until);
- }
- return 1;
- }
- DisableCheckpointForAll()
- {
- for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
- {
- if(!IsPlayerConnected(i)) continue;
- DisablePlayerCheckpoint(i);
- }
- }
- PlaySoundForAll(sound)
- {
- for(new i=0,j=GetPlayerPoolSize(); i <=j ; i++)
- {
- if(IsPlayerConnected(i)) PlayerPlaySound(i,sound,0,0,0);
- }
- }
- //==============================================================================
- // Important functions required
- //==============================================================================
- FUNCTION OnPlayerNameRecieve(playerid,name[])
- {
- format(PlayerMissionInfo[playerid][UserName],MAX_PLAYER_NAME,"%s",name);
- return 1;
- }
- FUNCTION CancelTheMission()
- {
- MissionCancelled= true;
- return 1;
- }
- FUNCTION MissionObjectiveStarted() return ObjectiveStarted;
- FUNCTION OnPlayerSpectateObjective(playerid)
- {
- SetPlayerCameraPos(playerid, CP_POS + 2.5);
- SetPlayerCameraLookAt(playerid, CP_POS);
- SetPlayerPos(playerid, CP_POS - 5);
- SetPlayerColor(playerid, (PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK) ? COLOR_TEAM_ATTACK_INV : COLOR_TEAM_DEFEND_INV);
- return 1;
- }
Advertisement
Add Comment
Please, Sign In to add comment