예제 #1
0
        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);
                }
            }
        }
예제 #2
0
파일: Police.cs 프로젝트: xentripetal/XenRP
        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);
                }
            }
        }