Beispiel #1
0
        /// <summary>
        /// Создать новый вызов
        /// </summary>
        private void CreateAlert(Vector3 position, string name)
        {
            var alert = new PoliceAlert(GetAlertId(), position, name);

            alert.CreateZone();
            _policeAlerts.Add(alert);
            SendAlertEvent(alert);
        }
Beispiel #2
0
 /// <summary>
 /// Обновить существующий вызов
 /// </summary>
 private void UpdateAlert(PoliceAlert existAlert, Vector3 position, string name)
 {
     existAlert.Position = position;
     if (name == MURDER_ALERT)
     {
         existAlert.Name = name;
     }
     API.deleteColShape(existAlert.Zone);
     existAlert.CreateZone();
     SendAlertEvent(existAlert, true);
 }
Beispiel #3
0
        /// <summary>
        /// Уведомляет всех полицейских о новом вызове
        /// </summary>
        private void SendAlertEvent(PoliceAlert alert, bool isUpdate = false)
        {
            var message = $"~r~[ВЫЗОВ] ~b~Тип: \"{alert.Name}\"";

            foreach (var policeman in GetPolicemens())
            {
                if (!isUpdate || alert.Name == MURDER_ALERT)
                {
                    API.sendNotificationToPlayer(policeman, message, true);
                }
                API.triggerClientEvent(policeman, isUpdate ? ServerEvent.UPDATE_ALERT : ServerEvent.CREATE_ALERT, JsonConvert.SerializeObject(alert));
            }
        }