Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Script by: Bullet
- Map by: Bullet
- Mission Base: Stealing
- Mission Type: Vehicle stealing
- Mission Type ID: 3
- */
- //==============================================================================
- // Includes
- //==============================================================================
- #include <a_samp>
- #include <crashdetect>
- #include <float>
- #include "..\filterscripts\MM\stuff\defines"
- #include "..\filterscripts\MM\stuff\serverkeymsg"
- //==============================================================================
- // Defines
- //==============================================================================
- #define MISSION_NAME "Sky Town"
- #define Health 99.0
- #define TEAM_DEFEND_NAME "Citizens"
- #define TEAM_ATTACK_NAME "Hobos"
- #define MAX_MAP_OBJECTS 49
- #define VEHICLE_HEALTH 999.0
- #define CLASS_POSTION 349.9381,147.0020,1518.6313
- #define CLASS_CAMERA 345.3366,146.7728,1520.6313
- #define CLASS_FACING_AGNLE 94.3672
- #define OBJ_POS 355.7650,203.1576,1500.7472,272.7633
- #define OBJ_ID 522
- #define OBJ_NAME "Bike"
- #define CP_POS 518.9354,171.5411,1501.1899
- #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, 212,494.8993,171.5156,1501.1899,90.2124,0,0,WEAPON_SILENCED,70,WEAPON_M4,200,0,0},
- {TEAM_DEFEND, 234,361.3232,175.5674,1501.1744,268.4081,0,0,WEAPON_DEAGLE,70,WEAPON_AK47,200,0,0}
- };
- #if MAX_MAP_OBJECTS != 0
- new Object[MAX_MAP_OBJECTS];
- CreateMap()
- {
- Object[0] = CreateObject(8664,422.5328100,154.4313000,1500.0963100,0.0000000,0.0000000,0.0000000); //
- Object[1] = CreateObject(17700,377.9726300,253.4915500,1505.0277100,0.0000000,0.0000000,-268.1999800); //
- Object[2] = CreateObject(17700,344.8277900,192.7537700,1506.5771500,0.0000000,0.0000000,-268.1999800); //
- Object[3] = CreateObject(17699,347.9403100,179.3568300,1504.2644000,0.0000000,0.0000000,-359.3998700); //
- Object[4] = CreateObject(17523,418.9091800,237.8929900,1501.9559300,0.0000000,0.0000000,450.4795500); //
- Object[5] = CreateObject(5175,443.9011200,250.4524500,1506.9599600,0.0000000,0.0000000,45.4198300); //
- Object[6] = CreateObject(4028,497.2677000,230.6561300,1513.4300500,0.0000000,0.0000000,0.0000000); //
- Object[7] = CreateObject(4028,502.7156700,212.0692000,1513.4300500,0.0000000,0.0000000,-90.0000200); //
- Object[8] = CreateObject(6332,393.6592400,83.1221700,1513.7567100,0.0000000,0.0000000,90.0000200); //
- Object[9] = CreateObject(6332,503.0554800,109.7647800,1513.1212200,0.0000000,0.0000000,-180.0001500); //
- Object[10] = CreateObject(6390,306.5016500,111.6905000,1509.2716100,0.0000000,0.0000000,-0.0000300); //
- Object[11] = CreateObject(6390,333.1899100,116.1613800,1505.2563500,0.0000000,0.0000000,-85.5000200); //
- Object[12] = CreateObject(6211,454.1393100,76.6469800,1503.4036900,0.0000000,0.0000000,-89.9999800); //
- Object[13] = CreateObject(6332,426.3976700,50.7227900,1513.7567100,0.0000000,0.0000000,153.3599900); //
- Object[14] = CreateObject(8566,373.4074100,149.0597500,1500.0520000,0.0000000,0.0000000,0.0000000); //
- Object[15] = CreateObject(8568,424.8049300,127.3452200,1504.2265600,0.0000000,0.0000000,0.0000000); //
- Object[16] = CreateObject(10610,409.3934900,250.8370700,1510.4440900,0.0000000,0.0000000,0.0000000); //
- Object[17] = CreateObject(8565,428.8584900,205.0651900,1505.6307400,0.0000000,0.0000000,0.0000000); //
- Object[18] = CreateObject(5711,455.6335100,167.8432900,1503.4561800,0.0000000,0.0000000,0.0000000); //
- Object[19] = CreateObject(9310,362.3967600,101.6866600,1505.9932900,0.0000000,0.0000000,0.0000000); //
- Object[20] = CreateObject(8230,362.5258800,118.9022800,1501.7810100,0.0000000,0.0000000,-180.0002400); //
- Object[21] = CreateObject(8230,362.6294600,136.5499300,1501.7810100,0.0000000,0.0000000,-180.0002400); //
- Object[22] = CreateObject(8230,362.8084700,136.5309400,1505.4395800,0.0000000,0.0000000,-180.0002400); //
- Object[23] = CreateObject(8230,362.7053200,118.8831000,1505.6799300,0.0000000,0.0000000,-180.0002400); //
- Object[24] = CreateObject(10631,392.8292800,107.8709400,1504.2274200,0.0000000,0.0000000,0.0000000); //
- Object[25] = CreateObject(11008,391.5167500,194.5702500,1506.8305700,0.0000000,0.0000000,0.0000000); //
- Object[26] = CreateObject(16563,445.1725500,136.7497100,1498.4719200,0.0000000,0.0000000,0.0000000); //
- Object[27] = CreateObject(16287,441.3108800,182.8490000,1499.9772900,0.0000000,0.0000000,90.0000200); //
- Object[28] = CreateObject(16287,426.3248900,182.8401900,1499.9772900,0.0000000,0.0000000,90.0000000); //
- Object[29] = CreateObject(6332,517.6047400,88.5145300,1513.1212200,0.0000000,0.0000000,-269.9998500); //
- Object[30] = CreateObject(4199,468.5321000,207.7163500,1502.0871600,0.0000000,0.0000000,0.0000000); //
- Object[31] = CreateObject(4892,511.7748400,167.3436300,1502.5997300,0.0000000,0.0000000,90.0000200); //
- Object[32] = CreateObject(6332,536.8450900,152.0094100,1513.1212200,0.0000000,0.0000000,-180.0001500); //
- Object[33] = CreateObject(6332,547.0435200,149.6632800,1513.1212200,0.0000000,0.0000000,-270.0000600); //
- Object[34] = CreateObject(6332,553.8574800,185.5469100,1513.1212200,0.0000000,0.0000000,-90.0002000); //
- Object[35] = CreateObject(16067,421.7327900,165.3416100,1499.9506800,0.0000000,0.0000000,0.0000000); //
- Object[36] = CreateObject(16070,383.3887300,133.6143200,1505.3772000,0.0000000,0.0000000,0.0000000); //
- Object[37] = CreateObject(3631,457.8663900,118.1205100,1500.6711400,0.0000000,0.0000000,0.0000000); //
- Object[38] = CreateObject(3631,457.8663900,118.1205100,1501.6862800,0.0000000,0.0000000,-19.3800000); //
- Object[39] = CreateObject(3865,438.5766900,146.3719200,1501.6723600,0.0000000,0.0000000,-270.0000000); //
- Object[40] = CreateObject(3865,429.3612100,146.2598100,1501.6723600,0.0000000,0.0000000,-449.9997300); //
- Object[41] = CreateObject(3865,420.3170500,146.5242000,1501.6723600,0.0000000,0.0000000,-630.0001800); //
- Object[42] = CreateObject(3865,411.1033000,146.4047900,1501.6723600,0.0000000,0.0000000,-809.9998800); //
- Object[43] = CreateObject(3865,402.9203800,146.4265900,1503.0636000,-20.0000000,0.0000000,-809.9998800); //
- Object[44] = CreateObject(3865,396.7132300,146.5973100,1497.6142600,90.0000000,90.0000000,-889.3798200); //
- Object[45] = CreateObject(16564,473.6767900,121.7926900,1500.0606700,0.0000000,0.0000000,-89.9999900); //
- Object[46] = CreateObject(8664,517.5587800,96.1911800,1500.1118200,0.0000000,0.0000000,0.0000000); //
- Object[47] = CreateObject(8664,512.2069700,241.1320300,1500.1118200,0.0000000,0.0000000,90.0000300); //
- Object[48] = CreateObject(8664,372.5615200,73.7987100,1500.1218300,0.0000000,0.0000000,-90.0000000); //
- }
- #endif
- //==============================================================================
- // Basic vars
- //==============================================================================
- new bool:MissionStarted;
- new bool:ObjectiveStarted;
- new bool:MissionCancelled;
- new bool:ObjectiveStolen;
- new ObjectiveStolenBy;
- native IsValidVehicle(vehicleid);
- enum obj
- {
- ObjectiveVeh,
- ObjectiveName[30],
- ObjectiveMarker,
- Float:ObjectiveEndX,
- Float:ObjectiveEndY,
- Float:ObjectiveEndZ
- };
- 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];
- //==============================================================================
- // 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);
- ObjectiveInfo[ObjectiveVeh] = CreateVehicle(OBJ_ID,OBJ_POS,random(225),random(225),3);
- SetVehicleHealth(ObjectiveInfo[ObjectiveVeh],1100);
- new iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective;
- GetVehicleParamsEx(ObjectiveInfo[ObjectiveVeh], iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, iObjective);
- SetVehicleParamsEx(ObjectiveInfo[ObjectiveVeh], iEngine, iLights, iAlarm, iDoors, iBonnet, iBoot, 1);
- AddStaticVehicleEx(461,3237.6956000,1286.4359000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3309.9316000,1285.8105000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3301.4075000,1285.6240000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3286.8469000,1286.7267000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3277.0708000,1286.9576000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3262.3457000,1285.7395000,6.7734000,-187.8600000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3252.6736000,1286.3423000,6.7111000,-187.8600000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3228.2878000,1285.9712000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3214.0562000,1286.0695000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3203.4856000,1285.7783000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3190.1631000,1287.0400000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3178.7856000,1287.3003000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3164.5676000,1286.5919000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3149.8867000,1287.0842000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3135.2725000,1287.9214000,6.7406000,-172.1400000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3244.4565000,861.1821000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3246.8936000,861.1639000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3249.0422000,861.0303000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3250.9873000,861.1275000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3242.0303000,861.1588000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
- AddStaticVehicleEx(461,3239.2468000,861.2847000,6.7155000,0.0000000,-1,-1,15); //PCJ-600
- #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] && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM)
- {
- 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)
- {
- SetPlayerHealth(playerid,Health);
- 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 steal 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),"Steal 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);
- #if SPAWN_PROTECTION == true
- CallRemoteFunction("SetSpawnProtection","df",playerid,Health);
- #endif
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_DEFEND) SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],playerid,1,1);
- else SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],playerid,1,0);
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID)
- {
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
- }
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
- {
- if(GetPlayerVehicleID(playerid) == ObjectiveInfo[ObjectiveVeh])
- {
- new string[124];
- format(string,sizeof(string),"%s has died and left the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
- DisablePlayerRaceCheckpoint(playerid);
- }
- }
- CallRemoteFunction("UpdateAliveState","ii",playerid,0);
- return 1;
- }
- public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
- {
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
- {
- if(vehicleid == ObjectiveInfo[ObjectiveVeh])
- {
- new string[124];
- format(string,sizeof(string),"%s is stealing the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
- SetPlayerCheckpoint(playerid,CP_POS,10.0);
- }
- }
- else
- {
- if(vehicleid == ObjectiveInfo[ObjectiveVeh])
- {
- new Float:x,Float:y,Float:z;
- GetPlayerPos(playerid,x,y,z);
- SetPlayerPos(playerid,x,y,z+3);
- ClearAnimations(playerid);
- }
- }
- return 1;
- }
- public OnPlayerExitVehicle(playerid, vehicleid)
- {
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
- {
- if(vehicleid == ObjectiveInfo[ObjectiveVeh])
- {
- new string[124];
- format(string,sizeof(string),"%s has left the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
- DisablePlayerCheckpoint(playerid);
- }
- }
- }
- public OnPlayerEnterCheckpoint(playerid)
- {
- if(!MissionStarted || ObjectiveStolen) return 1;
- if(PlayerMissionInfo[playerid][TeamSelection] == TEAM_ATTACK)
- {
- if(GetPlayerVehicleID(playerid) == ObjectiveInfo[ObjectiveVeh])
- {
- new string[124];
- format(string,sizeof(string),"%s has stolen the %s's %s.",PlayerMissionInfo[playerid][UserName],Team[TEAM_DEFEND][Name],ObjectiveInfo[ObjectiveName]);
- CallRemoteFunction("ShowInfoBox", "iisi", -1, -1, string,0);
- for(new i=0,j=GetPlayerPoolSize(); i <= j; i++) if(IsPlayerConnected(i)) DisablePlayerCheckpoint(i);
- DestroyVehicle(ObjectiveInfo[ObjectiveVeh]);
- ObjectiveStolen= true;
- ObjectiveStolenBy=playerid;
- CallRemoteFunction("EndMission","");
- PlayerPlaySound(playerid,1097,0,0,0);
- }
- }
- return 1;
- }
- public OnVehicleStreamIn(vehicleid, forplayerid)
- {
- if(vehicleid == ObjectiveInfo[ObjectiveVeh])
- {
- if(PlayerMissionInfo[forplayerid][TeamSelection] == TEAM_DEFEND) SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],forplayerid,1,1);
- else SetVehicleParamsForPlayer(ObjectiveInfo[ObjectiveVeh],forplayerid,1,0);
- }
- return 1;
- }
- public OnVehicleSpawn(vehicleid)
- {
- SetVehicleHealth(vehicleid,VEHICLE_HEALTH);
- if(vehicleid == ObjectiveInfo[ObjectiveVeh]) SetVehicleHealth(ObjectiveInfo[ObjectiveVeh],VEHICLE_HEALTH + (100*Team[TEAM_DEFEND][Members]));
- return 1;
- }
- FUNCTION EndTheMission()
- {
- if(!MissionStarted) return 1;
- MissionStarted= false;
- if(!MissionCancelled)
- {
- new string[128];
- new amount= 10000;
- if(!ObjectiveStolen)
- {
- 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) has stolen %s for %s to win the mission. Reward: $%d + Token",PlayerMissionInfo[ObjectiveStolenBy][UserName],ObjectiveInfo[ObjectiveName],ObjectiveStolenBy,Team[TEAM_ATTACK][Name],amount);
- SendClientMessageToAll(COLOR_SERVER,string);
- CallRemoteFunction("PlayerMissionStats","dd",ObjectiveStolenBy,7);
- CallRemoteFunction("GivePlayerToken","dd",ObjectiveStolenBy,1);
- 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_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
- //==============================================================================
- 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;
Advertisement
Add Comment
Please, Sign In to add comment