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 "Evening Sun"
- #define Health 99.0
- #define OBJ_NAME "The Fuel Ship"
- #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 "Nang Boys"
- #define TEAM_ATTACK_NAME "Cops"
- #define MAX_MAP_OBJECTS 8
- #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, 280, -1862.19995, -144.89999, 11.5,85.1686,0,0,WEAPON_M4,500,WEAPON_DEAGLE,210,WEAPON_SHOTGUN,50},
- {TEAM_DEFEND, 122,-1474.90002, 151.89999, 18.4,88.8383,0,0,WEAPON_AK47,30,WEAPON_CHINSAW,1,WEAPON_SHOTGSPA,210},
- };
- new const Float:ExplosionsInfo[][3] = {
- {-1593.0496,35.4267,24.6390},
- {-1581.7583,25.1551,24.6390},
- {-1591.5850,27.0092,33.6390},
- {-1615.1014,15.9942,23.6390},
- {-1626.4165,2.6474,16.6390},
- {-1543.2272,61.5388,16.6390},
- {-1543.6031,96.9205,16.6390},
- {-1503.0050,106.3370,16.6390},
- {-1486.5426,136.9788,16.6390}
- };
- #if MAX_MAP_OBJECTS != 0
- new Object[MAX_MAP_OBJECTS];
- CreateMap()
- {
- AddStaticVehicleEx(443,-1638.4000200,64.7000000,4.3000000,316.0000000,34,25,15); //Packer
- AddStaticVehicleEx(578,-1604.1999500,49.5000000,4.3000000,136.0000000,245,245,15); //DFT-30
- AddStaticVehicleEx(486,-1550.5000000,63.6000000,17.6000000,134.0000000,245,245,15); //Dozer
- AddStaticVehicleEx(413,-1561.9000200,76.9000000,17.5000000,44.0000000,100,104,15); //Pony
- AddStaticVehicleEx(413,-1487.5999800,132.6000100,17.5000000,133.9950000,100,104,15); //Pony
- AddStaticVehicleEx(413,-1571.5999800,137.3000000,3.7000000,135.9950000,100,104,15); //Pony
- AddStaticVehicleEx(435,-1597.1999500,50.1000000,18.0000000,314.0000000,245,245,15); //Trailer 1
- AddStaticVehicleEx(450,-1594.9000200,116.3000000,4.2000000,136.0000000,245,245,15); //Trailer 2
- AddStaticVehicleEx(414,-1599.4000200,84.4000000,3.7000000,136.0000000,63,62,15); //Mule
- AddStaticVehicleEx(414,-1533.0000000,88.7000000,17.5000000,46.0000000,63,62,15); //Mule
- AddStaticVehicleEx(422,-1551.5000000,93.2000000,17.4000000,316.0000000,71,53,15); //Bobcat
- AddStaticVehicleEx(422,-1577.5999800,28.0000000,17.4000000,326.0000000,71,53,15); //Bobcat
- AddStaticVehicleEx(422,-1672.0000000,40.8000000,3.6000000,145.9970000,71,53,15); //Bobcat
- AddStaticVehicleEx(456,-1530.8000500,161.1000100,3.8000000,130.0000000,93,126,15); //Yankee
- AddStaticVehicleEx(498,-1663.6999500,3.7000000,3.8000000,40.0000000,81,84,15); //Boxville
- AddStaticVehicleEx(406,-1704.6999500,15.3000000,6.0000000,316.0000000,245,245,15); //Dumper
- AddStaticVehicleEx(514,-1590.1999500,56.8000000,18.0000000,314.0000000,37,37,15); //Tanker
- AddStaticVehicleEx(514,-1601.1999500,109.8000000,4.3000000,133.9950000,37,37,15); //Tanker
- AddStaticVehicleEx(422,-1527.8000500,125.6000000,3.6000000,325.9920000,71,53,15); //Bobcat
- AddStaticVehicleEx(597,-1876.8000500,-147.6000100,11.8000000,80.0000000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(599,-1851.5000000,-136.8000000,12.3000000,90.0000000,15,15,15); //Police Ranger
- AddStaticVehicleEx(427,-1852.5999800,-129.1000100,12.1000000,90.0000000,15,15,15); //Enforcer
- AddStaticVehicleEx(523,-1850.3000500,-141.8000000,11.6000000,90.0000000,15,15,15); //HPV1000
- AddStaticVehicleEx(427,-1882.0000000,-167.7000000,12.2000000,0.0000000,15,15,15); //Enforcer
- AddStaticVehicleEx(597,-1876.8000500,-153.8000000,11.8000000,79.9970000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1876.5000000,-150.7000000,11.8000000,79.9970000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1851.3000500,-144.2000000,11.8000000,89.9970000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1851.5999800,-133.0000000,11.8000000,89.9950000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(523,-1850.3000500,-140.0000000,11.6000000,90.0000000,15,15,15); //HPV1000
- AddStaticVehicleEx(599,-1870.0999800,-127.1000000,12.3000000,80.0000000,15,15,15); //Police Ranger
- AddStaticVehicleEx(599,-1853.4000200,-169.8000000,9.6000000,269.9970000,15,15,15); //Police Ranger
- AddStaticVehicleEx(599,-1840.5999800,-110.4000000,6.0000000,269.9950000,15,15,15); //Police Ranger
- AddStaticVehicleEx(597,-1871.3000500,-142.8000000,11.8000000,359.9950000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1885.0999800,-133.1000100,12.2000000,339.9950000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1882.4000200,-123.8000000,12.7000000,349.9940000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1887.5000000,-142.8999900,11.8000000,349.9910000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1888.5999800,-158.3000000,11.8000000,359.9910000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1870.8000500,-178.1000100,9.2000000,269.9890000,15,15,15); //Police Car (SFPD)
- AddStaticVehicleEx(597,-1864.4000200,-178.1000100,9.2000000,269.9890000,15,15,15); //Police Car (SFPD)
- Object[0] = CreateObject(8615,-1600.9000200,44.3000000,23.8000000,0.0000000,0.0000000,135.0000000); //
- Object[1] = CreateObject(8614,-1582.4000200,25.9000000,24.3000000,0.0000000,0.0000000,135.0000000); //
- Object[2] = CreateObject(14410,-1608.0999800,40.2000000,22.3000000,0.0000000,0.0000000,314.0000000); //
- Object[3] = CreateObject(14410,-1613.0999800,35.3000000,17.3000000,0.0000000,0.0000000,313.9950000); //
- Object[4] = CreateObject(14410,-1586.6999500,18.9000000,22.3000000,0.0000000,0.0000000,313.9950000); //
- Object[5] = CreateObject(14410,-1592.0000000,13.8000000,17.3000000,0.0000000,0.0000000,313.9950000); //
- Object[6] = CreateObject(14410,-1590.5000000,40.0000000,19.4000000,0.0000000,0.0000000,134.9950000); //
- Object[7] = CreateObject(14410,-1587.6999500,37.2000000,19.4000000,0.0000000,0.0000000,134.9950000); //
- }
- #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