Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- Script by: Bullet
- Map by: Bullet
- Mission Base: Team Deathmatch
- Mission Type: Team Deathmatch
- Mission Type ID: 6
- */
- //==============================================================================
- // Includes
- //==============================================================================
- #include <a_samp>
- #include <crashdetect>
- #include <float>
- #include <fixes2>
- #include "..\filterscripts\MM\stuff\defines"
- #include "..\filterscripts\MM\stuff\serverkeymsg"
- //==============================================================================
- // Defines
- //==============================================================================
- #define MISSION_NAME "Los Santos Bash"
- #define Health 99.0
- #define TEAM_DEFEND_NAME "Groves"
- #define TEAM_ATTACK_NAME "Ballas"
- #define MAX_MAP_OBJECTS 0
- #define VEHICLE_HEALTH 0
- #define CLASS_POSTION 1960.3746,-1206.2233,27.0981
- #define CLASS_CAMERA 1966.6736,-1205.9620,27.6609
- #define CLASS_FACING_AGNLE 269.6407
- #define SINKING false
- #define SPAWN_PROTECTION true
- //==============================================================================
- // Per mission functions
- //==============================================================================
- enum ped_enum
- {
- TeamID,
- Skin,
- Float:SpawnX,
- Float:SpawnY,
- Float:SpawnZ,
- Float:SpawnAngle,
- SpawnInterior,
- VirtualWorld,
- Weapon1,
- Ammo1,
- Weapon2,
- Ammo2,
- Weapon3,
- Ammo3,
- };
- new PedInfo[][ped_enum] = {
- {TEAM_ATTACK, 102, 2053.9026,-1151.6842,23.7296,99.0651,0,0,WEAPON_BAT,1,WEAPON_DEAGLE,250,WEAPON_AK47,500},
- {TEAM_DEFEND, 105, 1863.5563,-1239.7374,15.1647,271.2530,0,0,WEAPON_BAT,1,WEAPON_DEAGLE,250,WEAPON_AK47,500},
- {TEAM_ATTACK, 103, 2053.9026,-1151.6842,23.7296,99.0651,0,0,0,0,0,0,WEAPON_SHOTGSPA,300},
- {TEAM_DEFEND, 106, 1863.5563,-1239.7374,15.1647,271.2530,0,0,0,0,0,0,WEAPON_SHOTGSPA,300},
- {TEAM_ATTACK, 104, 2053.9026,-1151.6842,23.7296,99.0651,0,0,WEAPON_COLT45,450,WEAPON_MP5,450,WEAPON_M4,500},
- {TEAM_DEFEND, 107, 1863.5563,-1239.7374,15.1647,271.2530,0,0,WEAPON_COLT45,450,WEAPON_MP5,450,WEAPON_M4,500}
- };
- #if SINKING == true
- new MapSkining[2];
- #endif
- #if MAX_MAP_OBJECTS != 0
- new Object[MAX_MAP_OBJECTS];
- CreateMap()
- {
- }
- #endif
- //==============================================================================
- // Basic vars
- //==============================================================================
- new bool:MissionStarted;
- new bool:ObjectiveStarted;
- new bool:MissionCancelled;
- native IsValidVehicle(vehicleid);
- enum teamdata
- {
- Kills,
- Name[32],
- Members
- };
- enum playerdata
- {
- UserName[MAX_PLAYER_NAME],
- bool:Counted,
- TeamSelection,
- PlayerClassID
- };
- new Team[2][teamdata];
- new PlayerMissionInfo[MAX_PLAYERS][playerdata];
- //==============================================================================
- // 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);
- if(CallRemoteFunction("GetCurrentMissionCJWalk","")) UsePlayerPedAnims();
- #if MAX_MAP_OBJECTS != 0
- CreateMap();
- #endif
- for(new i=0; i<sizeof(PedInfo); i++)AddPlayerClassEx(PedInfo[i][TeamID],PedInfo[i][Skin],PedInfo[i][SpawnX],PedInfo[i][SpawnY],PedInfo[i][SpawnZ],PedInfo[i][SpawnAngle],0,0,0,0,0,0);
- #if SINKING == true
- MapSkining[0] = SetTimer("SinkMap", 80*1000, false);
- #endif
- for(new i=0; i<MAX_VEHICLES; i++) if(IsValidVehicle(i)) SetVehicleHealth(i,VEHICLE_HEALTH);
- for(new i=0; i<MAX_PLAYERS; i++) PlayerMissionInfo[i][TeamSelection]= NO_TEAM;
- 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
- return 1;
- }
- public OnPlayerDisconnect(playerid)
- {
- if(PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM && PlayerMissionInfo[playerid][Counted])
- {
- Team[PlayerMissionInfo[playerid][TeamSelection]][Members] --;
- PlayerMissionInfo[playerid][Counted] = 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("TdmHide","i",playerid);
- CallRemoteFunction("ShowClassSelection","ddsddd",playerid, PedInfo[classid][TeamID],Team[PedInfo[classid][TeamID]][Name], PedInfo[classid][Weapon1], PedInfo[classid][Weapon2], PedInfo[classid][Weapon3]);
- if(PlayerMissionInfo[playerid][Counted] && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM)
- {
- Team[PlayerMissionInfo[playerid][TeamSelection]][Members]--;
- PlayerMissionInfo[playerid][Counted] = false;
- }
- PlayerMissionInfo[playerid][TeamSelection] = PedInfo[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);
- CallRemoteFunction("TdmShow","i",playerid);
- CallRemoteFunction("TdmUpdate","sssdd","Kills",Team[TEAM_DEFEND][Name],Team[TEAM_ATTACK][Name],Team[TEAM_DEFEND][Kills],Team[TEAM_ATTACK][Kills]);
- SetPlayerHealth(playerid,Health);
- if(CallRemoteFunction("GetSpectateStatus","d",playerid)) return CallRemoteFunction("SpecOffAdmin","d",playerid);
- if(CallRemoteFunction("GetJailedStatus","d",playerid)) CallRemoteFunction("SetJailed","d",playerid);
- else
- {
- SetPlayerPos(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnX],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnY],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnZ]);
- SetPlayerFacingAngle(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnAngle]);
- SetPlayerInterior(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][SpawnInterior]);
- SetPlayerVirtualWorld(playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][VirtualWorld]);
- CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Weapon1],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Ammo1]);
- CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Weapon2],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Ammo2]);
- CallRemoteFunction("GivePlayerWeaponEx","ddd",playerid,PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Weapon3],PedInfo[PlayerMissionInfo[playerid][PlayerClassID]][Ammo3]);
- if(!PlayerMissionInfo[playerid][Counted])
- {
- Team[PlayerMissionInfo[playerid][TeamSelection]][Members]++;
- PlayerMissionInfo[playerid][Counted] = true;
- new opp_team = (PlayerMissionInfo[playerid][TeamSelection] == 1)? 0:1;
- format(string,sizeof(string),"You have chosen team %s, your mission is to kill %s.",Team[PlayerMissionInfo[playerid][TeamSelection]][Name],Team[opp_team][Name]);
- CallRemoteFunction("ShowInfoBox", "iisi", playerid, -1,string,0);
- format(string,sizeof(string),"~r~~h~Eliminate ~w~%s.",Team[opp_team][Name]);
- CallRemoteFunction("ShowInfoText", "iisi", playerid, -1,string,0);
- }
- }
- 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
- return 1;
- }
- public OnPlayerDeath(playerid, killerid, reason)
- {
- if(killerid != INVALID_PLAYER_ID && PlayerMissionInfo[playerid][TeamSelection] != NO_TEAM && MissionStarted)
- {
- Team[PlayerMissionInfo[killerid][TeamSelection]][Kills]++;
- SetPlayerScore(killerid,GetPlayerScore(killerid)+1);
- CallRemoteFunction("TdmUpdate","sssdd","Kills",Team[TEAM_DEFEND][Name],Team[TEAM_ATTACK][Name],Team[TEAM_DEFEND][Kills],Team[TEAM_ATTACK][Kills]);
- }
- CallRemoteFunction("UpdateAliveState","ii",playerid,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;
- new winning_team;
- if(Team[TEAM_DEFEND][Kills] == Team[TEAM_ATTACK][Kills]) { winning_team = 2; }
- else if(Team[TEAM_DEFEND][Kills] > Team[TEAM_ATTACK][Kills]) { winning_team = 0; }
- else { winning_team = 1; }
- if(winning_team != 2)
- {
- amount =amount+(Team[winning_team][Kills]*100);
- format(string,sizeof(string),""SERVER_KEY_MSG" %s has won the team deathmatch! Reward: $%d",Team[winning_team][Name],amount);
- CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
- SendClientMessageToAll(COLOR_SERVER,string);
- 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][TeamSelection] == winning_team && PlayerMissionInfo[i][Counted])
- {
- PlayerPlaySound(i,3200,0,0,0);
- SendClientMessage(i,COLOR_SERVER,string);
- CallRemoteFunction("GivePlayerCash","ii",i,amount);
- CallRemoteFunction("PlayerMissionStats","dd",i,0);
- CallRemoteFunction("PlayerMissionStats","dd",i,6);
- }
- if(PlayerMissionInfo[i][TeamSelection] != winning_team && PlayerMissionInfo[i][Counted])
- {
- PlayerPlaySound(i,17004,0,0,0);
- GameTextForPlayer(i,"~R~MISSION FAILED~w~!",3000,3);
- CallRemoteFunction("PlayerMissionStats","dd",i,1);
- }
- }
- }
- else
- {
- PlaySoundForAll(1058);
- format(string,sizeof(string),""SERVER_KEY_MSG" IT'S A DRAW! No team has won the team-deathmatch.");
- SendClientMessageToAll(COLOR_SERVER,string);
- CallRemoteFunction("IRC_SendMessage","ss",string,IRC_SERVER_COLOR);
- for(new i=0,j=GetPlayerPoolSize(); i <= j; i++) if(IsPlayerConnected(i) && PlayerMissionInfo[i][Counted]) CallRemoteFunction("PlayerMissionStats","dd",i,2);
- }
- }
- 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
- //==============================================================================
- #if SINKING == true
- FUNCTION SinkMap()
- {
- GameTextForAll("~r~the island is sinking!",4000,3);
- new Float:X, Float:Y, Float:Z;
- new Float:oldRotX, Float:oldRotY, Float:oldRotZ;
- for(new i = 0; i < MAX_MAP_OBJECTS; i++) { GetObjectPos(Object[i], X, Y, Z), GetObjectRot(Object[i], oldRotX, oldRotY, oldRotZ); MoveObject(Object[i], X, Y, Z-40, 0.6, oldRotX, oldRotY, oldRotZ+0.05); }
- MapSkining[0] = SetTimer("ResurfaceMap", 150*1000,false);
- return true;
- }
- FUNCTION ResurfaceMap()
- {
- GameTextForAll("~g~the island is resurfacing!",4000,3);
- new Float:X, Float:Y, Float:Z;
- new Float:oldRotX, Float:oldRotY, Float:oldRotZ;
- for(new i = 0; i < MAX_MAP_OBJECTS; i++) { GetObjectPos(Object[i], X, Y, Z), GetObjectRot(Object[i], oldRotX, oldRotY, oldRotZ); MoveObject(Object[i], X, Y, Z+40, 0.6, oldRotX, oldRotY, oldRotZ-0.05); }
- //MapSkining[1] = SetTimer("SinkMap", 80000,false);
- return true;
- }
- #endif
- 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
Advertisement