public static void CleanUp(int relationship, DispatchManager.DispatchType type) { World.RemoveRelationshipGroup(relationship); switch (type) { case DispatchManager.DispatchType.ArmyGround: case DispatchManager.DispatchType.ArmyHeli: case DispatchManager.DispatchType.ArmyRoadBlock: { if (armyRelationships.Contains(relationship)) { armyRelationships.Remove(relationship); } break; } case DispatchManager.DispatchType.CopGround: case DispatchManager.DispatchType.CopHeli: case DispatchManager.DispatchType.CopRoadBlock: { if (copRelationships.Contains(relationship)) { copRelationships.Remove(relationship); } break; } } }
public static bool AnyEmergencyIsNear(Vector3 position, DispatchManager.DispatchType dispatchType, EventManager.EventType eventType) { if (position.Equals(Vector3.Zero)) { return(false); } List <Ped> nearbyPeds = new List <Ped>(World.GetNearbyPeds(position, 100.0f)); if (nearbyPeds.Count < 1) { return(false); } int max = 0; switch (eventType) { case EventManager.EventType.AggressiveDriver: case EventManager.EventType.GangTeam: max = 2; break; case EventManager.EventType.Carjacker: max = 0; break; case EventManager.EventType.Massacre: case EventManager.EventType.Driveby: case EventManager.EventType.Racer: max = 4; break; case EventManager.EventType.Terrorist: max = 6; break; } return((nearbyPeds.FindAll(p => WeCanGiveTaskTo(p) && dispatchType.Equals(DispatchManager.DispatchType.ArmyGround) ? armyRelationships.Contains(p.RelationshipGroup) : copRelationships.Contains(p.RelationshipGroup))).Count > max); }
public static int NewRelationshipOf(DispatchManager.DispatchType type) { int newRel = World.AddRelationshipGroup((count++).ToString()); if (newRel != 0) { switch (type) { case DispatchManager.DispatchType.ArmyGround: case DispatchManager.DispatchType.ArmyHeli: case DispatchManager.DispatchType.ArmyRoadBlock: { foreach (int i in criminalRelationships) { World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i); } foreach (int i in armyRelationships) { World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, i); } foreach (int i in copRelationships) { World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, i); } if (!Main.DispatchesCanFightWithPlayer) { World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, playerID); } World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, Function.Call <int>(Hash.GET_HASH_KEY, "FIREMAN")); World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, Function.Call <int>(Hash.GET_HASH_KEY, "MEDIC")); World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, newRel); armyRelationships.Add(newRel); break; } case DispatchManager.DispatchType.CopGround: case DispatchManager.DispatchType.CopHeli: case DispatchManager.DispatchType.CopRoadBlock: { foreach (int i in criminalRelationships) { World.SetRelationshipBetweenGroups(Relationship.Hate, newRel, i); } foreach (int i in armyRelationships) { World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, i); } foreach (int i in copRelationships) { World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, i); } if (!Main.DispatchesCanFightWithPlayer) { World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, playerID); } World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, Function.Call <int>(Hash.GET_HASH_KEY, "FIREMAN")); World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, Function.Call <int>(Hash.GET_HASH_KEY, "MEDIC")); World.SetRelationshipBetweenGroups(Relationship.Like, newRel, Function.Call <int>(Hash.GET_HASH_KEY, "SECURITY_GUARD")); World.SetRelationshipBetweenGroups(Relationship.Dislike, newRel, Function.Call <int>(Hash.GET_HASH_KEY, "DEALER")); World.SetRelationshipBetweenGroups(Relationship.Respect, newRel, newRel); copRelationships.Add(newRel); break; } } } return(newRel); }