private void UpdateReinforcesRequests(object unused) { List <ReinforcesModel> policeReinforces = new List <ReinforcesModel>(); List <Client> policeMembers = NAPI.Pools.GetAllPlayers().Where(x => x.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_POLICE).ToList(); foreach (Client police in policeMembers) { if (police.HasData(EntityData.PLAYER_REINFORCES) == true) { ReinforcesModel reinforces = new ReinforcesModel(police.Value, police.Position); policeReinforces.Add(reinforces); } } string reinforcesJsonList = NAPI.Util.ToJson(policeReinforces); foreach (Client police in policeMembers) { if (police.HasData(EntityData.PLAYER_PLAYING) == true) { // Update reinforces position for each policeman police.TriggerEvent("updatePoliceReinforces", reinforcesJsonList); } } }
private void UpdateReinforcesRequests(object unused) { var policeReinforces = new List <ReinforcesModel>(); var policeMembers = NAPI.Pools.GetAllPlayers().Where(x => Faction.IsPoliceMember(x)).ToList(); foreach (var police in policeMembers) { if (police.GetData(EntityData.PLAYER_REINFORCES) != null) { var reinforces = new ReinforcesModel(police.Value, police.Position); policeReinforces.Add(reinforces); } } var reinforcesJsonList = NAPI.Util.ToJson(policeReinforces); foreach (var police in policeMembers) { if (police.GetData(EntityData.PLAYER_PLAYING) != null) { police.TriggerEvent("updatePoliceReinforces", reinforcesJsonList); } } }