Пример #1
0
        public void ClearReportsCommand(Client player, int warning)
        {
            int faction = player.GetData(EntityData.PLAYER_FACTION);

            if (IsPoliceMember(player) || faction == Constants.FACTION_EMERGENCY)
            {
                try
                {
                    FactionWarningModel factionWarning = factionWarningList.ElementAt(warning);

                    // Check the faction and whether the report is attended
                    if (factionWarning.faction != faction)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_not_found);
                    }
                    else
                    {
                        // We remove the report
                        factionWarningList.Remove(factionWarning);

                        // Send the message to the user
                        string message = string.Format(InfoRes.faction_warning_deleted, warning);
                        player.SendChatMessage(Constants.COLOR_INFO + message);
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_not_found);
                }
            }
            else
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_police_emergency_faction);
            }
        }
Пример #2
0
        public static void CancelPlayerDeath(Client player)
        {
            NAPI.Player.SpawnPlayer(player, player.Position);
            player.SetSharedData(EntityData.PLAYER_KILLED, 0);
            player.ResetData(EntityData.TIME_HOSPITAL_RESPAWN);

            // Get the death warning
            FactionWarningModel factionWarn = Faction.GetFactionWarnByTarget(player.Value, Constants.FACTION_EMERGENCY);

            if (factionWarn != null)
            {
                if (factionWarn.takenBy >= 0)
                {
                    // Tell the player who attended the report it's been canceled
                    Client doctor = Globals.GetPlayerById(factionWarn.takenBy);
                    doctor.SendChatMessage(Constants.COLOR_INFO + InfoRes.faction_warn_canceled);
                }

                // Remove the report from the list
                Faction.factionWarningList.Remove(factionWarn);
            }

            // Change the death state
            player.TriggerEvent("togglePlayerDead", false);
        }
Пример #3
0
        private void OnPlayerDeathHandler(Client player, Client killer, uint weapon, CancelEventArgs cancel)
        {
            DeathModel death = new DeathModel(player, killer, weapon);

            // Creamos las variables para dar el aviso
            Vector3 deathPosition = null;
            String  deathPlace    = String.Empty;
            String  deathHour     = DateTime.Now.ToString("h:mm:ss tt");

            // Miramos el lugar donde ha muerto
            if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED) > 0)
            {
                int        houseId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED);
                HouseModel house   = House.GetHouseById(houseId);
                deathPosition = house.position;
                deathPlace    = house.name;
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED) > 0)
            {
                int           businessId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED);
                BusinessModel business   = Business.GetBusinessById(businessId);
                deathPosition = business.position;
                deathPlace    = business.name;
            }
            else
            {
                deathPosition = NAPI.Entity.GetEntityPosition(player);
            }

            // Creamos el aviso y lo añadimos a la lista
            FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour);

            Faction.factionWarningList.Add(factionWarning);

            // Creamos el mensaje de aviso
            String warnMessage = String.Format(Messages.INF_EMERGENCY_WARNING, Faction.factionWarningList.Count - 1);

            // Damos el aviso a todos los médicos de servicio
            foreach (Client target in NAPI.Pools.GetAllPlayers())
            {
                if (NAPI.Data.GetEntityData(target, EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && NAPI.Data.GetEntityData(target, EntityData.PLAYER_ON_DUTY) > 0)
                {
                    NAPI.Chat.SendChatMessageToPlayer(target, Constants.COLOR_INFO + warnMessage);
                }
            }

            // Creamos el timer para poner el estado de muerto
            Timer deathTimer = new Timer(OnDeathTimer, death, 2500, Timeout.Infinite);

            deathTimerList.Add(player.Value, deathTimer);

            // Evitamos el respawn
            cancel.Spawn = false;
        }
Пример #4
0
        public void OnPlayerDeath(Client player, Client killer, uint weapon)
        {
            if (player.GetData(EntityData.PLAYER_KILLED) == 0)
            {
                var death = new DeathModel(player, killer, weapon);

                Vector3 deathPosition = null;
                var     deathPlace    = string.Empty;
                var     deathHour     = DateTime.Now.ToString("h:mm:ss tt");

                // Checking if player died into a house or business
                if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0)
                {
                    int houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED);
                    var house   = House.GetHouseById(houseId);
                    deathPosition = house.position;
                    deathPlace    = house.name;
                }
                else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0)
                {
                    int businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED);
                    var business   = Business.GetBusinessById(businessId);
                    deathPosition = business.position;
                    deathPlace    = business.name;
                }
                else
                {
                    deathPosition = player.Position;
                }

                // We add the report to the list
                var factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace,
                                                             deathPosition, -1, deathHour);
                Faction.factionWarningList.Add(factionWarning);

                // Report message
                var warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1);

                // Sending the report to all the emergency department's members
                foreach (var target in NAPI.Pools.GetAllPlayers())
                {
                    if (target.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY &&
                        target.GetData(EntityData.PLAYER_ON_DUTY) > 0)
                    {
                        target.SendChatMessage(Constants.COLOR_INFO + warnMessage);
                    }
                }

                // Create the emergency report
                CreateEmergencyReport(death);
            }
        }
Пример #5
0
        public void OnPlayerDeath(Client player, Client killer, uint weapon)
        {
            DeathModel death = new DeathModel(player, killer, weapon);

            Vector3 deathPosition = null;
            String  deathPlace    = String.Empty;
            String  deathHour     = DateTime.Now.ToString("h:mm:ss tt");

            // Checking if player died into a house or business
            if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED) > 0)
            {
                int        houseId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED);
                HouseModel house   = House.GetHouseById(houseId);
                deathPosition = house.position;
                deathPlace    = house.name;
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED) > 0)
            {
                int           businessId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED);
                BusinessModel business   = Business.GetBusinessById(businessId);
                deathPosition = business.position;
                deathPlace    = business.name;
            }
            else
            {
                deathPosition = NAPI.Entity.GetEntityPosition(player);
            }

            // We add the report to the list
            FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour);

            Faction.factionWarningList.Add(factionWarning);

            // Report message
            String warnMessage = String.Format(Messages.INF_EMERGENCY_WARNING, Faction.factionWarningList.Count - 1);

            // Sending the report to all the emergency department's members
            foreach (Client target in NAPI.Pools.GetAllPlayers())
            {
                if (NAPI.Data.GetEntityData(target, EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && NAPI.Data.GetEntityData(target, EntityData.PLAYER_ON_DUTY) > 0)
                {
                    NAPI.Chat.SendChatMessageToPlayer(target, Constants.COLOR_INFO + warnMessage);
                }
            }

            // Timer to process player's death
            Timer deathTimer = new Timer(OnDeathTimer, death, 2500, Timeout.Infinite);

            deathTimerList.Add(player.Value, deathTimer);
        }
Пример #6
0
        public void AttendCommand(Client player, int warning)
        {
            int faction = player.GetData(EntityData.PLAYER_FACTION);

            if (faction == Constants.FACTION_POLICE || faction == Constants.FACTION_EMERGENCY)
            {
                try
                {
                    FactionWarningModel factionWarning = factionWarningList.ElementAt(warning);

                    // Check the faction and whether the report is attended
                    if (factionWarning.faction != faction)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_not_found);
                    }
                    else if (factionWarning.takenBy > -1)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_taken);
                    }
                    else if (factionWarning.playerId == player.Value)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_own_death);
                    }
                    else if (player.HasData(EntityData.PLAYER_FACTION_WARNING) == true)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_have_faction_warning);
                    }
                    else
                    {
                        Checkpoint factionWarningCheckpoint = NAPI.Checkpoint.CreateCheckpoint(4, factionWarning.position, new Vector3(0.0f, 0.0f, 0.0f), 2.5f, new Color(198, 40, 40, 200));
                        player.SetData(EntityData.PLAYER_FACTION_WARNING, factionWarningCheckpoint);
                        factionWarning.takenBy = player.Value;

                        player.SendChatMessage(Constants.COLOR_INFO + InfoRes.faction_warning_taken);

                        player.TriggerEvent("showFactionWarning", factionWarning.position);
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_not_found);
                }
            }
            else
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_police_emergency_faction);
            }
        }
Пример #7
0
        private void GeneratePoliceRobberyWarning(Client player)
        {
            Vector3 robberyPosition;
            var     robberyPlace = string.Empty;
            var     robberyHour  = DateTime.Now.ToString("h:mm:ss tt");

            // Check if he robbed into a house or business
            if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0)
            {
                int houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED);
                var house   = House.GetHouseById(houseId);
                robberyPosition = house.position;
                robberyPlace    = house.name;
            }
            else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0)
            {
                int businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED);
                var business   = Business.GetBusinessById(businessId);
                robberyPosition = business.position;
                robberyPlace    = business.name;
            }
            else
            {
                robberyPosition = player.Position;
            }

            // Create the police report
            var policeWarning = new FactionWarningModel(Constants.FACTION_POLICE, player.Value, robberyPlace,
                                                        robberyPosition, -1, robberyHour);
            var sheriffWarning = new FactionWarningModel(Constants.FACTION_SHERIFF, player.Value, robberyPlace,
                                                         robberyPosition, -1, robberyHour);

            Faction.factionWarningList.Add(policeWarning);
            Faction.factionWarningList.Add(sheriffWarning);

            var warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1);

            // Get all the members from any police faction
            var members = NAPI.Pools.GetAllPlayers()
                          .Where(m => Faction.IsPoliceMember(m) && m.GetData(EntityData.PLAYER_ON_DUTY) == 1).ToList();

            foreach (var target in members)
            {
                // Send the warning
                target.SendChatMessage(Constants.COLOR_INFO + warnMessage);
            }
        }
Пример #8
0
        public void AttendCommand(Client player, int warning)
        {
            int faction = player.GetData(EntityData.PLAYER_FACTION);

            if (IsPoliceMember(player) || faction == Constants.FACTION_EMERGENCY)
            {
                try
                {
                    FactionWarningModel factionWarning = factionWarningList.ElementAt(warning);

                    // Check the faction and whether the report is attended
                    if (factionWarning.faction != faction)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_not_found);
                    }
                    else if (factionWarning.takenBy > -1)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_taken);
                    }
                    else if (factionWarning.playerId == player.Value)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_own_death);
                    }
                    else if (player.GetData(EntityData.PLAYER_FACTION_WARNING) != null)
                    {
                        player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_have_faction_warning);
                    }
                    else
                    {
                        player.SetData(EntityData.PLAYER_FACTION_WARNING, true);
                        factionWarning.takenBy = player.Value;

                        player.SendChatMessage(Constants.COLOR_INFO + InfoRes.faction_warning_taken);

                        player.TriggerEvent("showFactionWarning", factionWarning.position);
                    }
                }
                catch (ArgumentOutOfRangeException)
                {
                    player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.faction_warning_not_found);
                }
            }
            else
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_police_emergency_faction);
            }
        }
Пример #9
0
        private void GeneratePoliceRobberyWarning(Client player)
        {
            // Creamos las variables para dar el aviso
            Vector3 robberyPosition = null;
            String  robberyPlace    = String.Empty;
            String  robberyHour     = DateTime.Now.ToString("h:mm:ss tt");

            // Miramos el lugar donde ha muerto
            if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED) > 0)
            {
                int        houseId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_HOUSE_ENTERED);
                HouseModel house   = House.GetHouseById(houseId);
                robberyPosition = house.position;
                robberyPlace    = house.name;
            }
            else if (NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED) > 0)
            {
                int           businessId = NAPI.Data.GetEntityData(player, EntityData.PLAYER_BUSINESS_ENTERED);
                BusinessModel business   = Business.GetBusinessById(businessId);
                robberyPosition = business.position;
                robberyPlace    = business.name;
            }
            else
            {
                robberyPosition = NAPI.Entity.GetEntityPosition(player);
            }

            // Creamos el aviso y lo añadimos a la lista
            FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_POLICE, player.Value, robberyPlace, robberyPosition, -1, robberyHour);

            Faction.factionWarningList.Add(factionWarning);

            // Creamos el mensaje de aviso
            String warnMessage = String.Format(Messages.INF_EMERGENCY_WARNING, Faction.factionWarningList.Count - 1);

            // Avisamos a los miembros de la policía conectados
            foreach (Client target in NAPI.Pools.GetAllPlayers())
            {
                if (NAPI.Data.GetEntityData(target, EntityData.PLAYER_FACTION) == Constants.FACTION_POLICE && NAPI.Data.GetEntityData(target, EntityData.PLAYER_ON_DUTY) == 1)
                {
                    NAPI.Chat.SendChatMessageToPlayer(target, Constants.COLOR_INFO + warnMessage);
                }
            }
        }
Пример #10
0
        private void GeneratePoliceRobberyWarning(Client player)
        {
            Vector3 robberyPosition;
            string  robberyPlace = string.Empty;
            string  robberyHour  = DateTime.Now.ToString("h:mm:ss tt");

            // Check if he robbed into a house or business
            if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0)
            {
                int        houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED);
                HouseModel house   = House.GetHouseById(houseId);
                robberyPosition = house.position;
                robberyPlace    = house.name;
            }
            else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0)
            {
                int           businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED);
                BusinessModel business   = Business.GetBusinessById(businessId);
                robberyPosition = business.position;
                robberyPlace    = business.name;
            }
            else
            {
                robberyPosition = player.Position;
            }

            // Create the police report
            FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_POLICE, player.Value, robberyPlace, robberyPosition, -1, robberyHour);

            Faction.factionWarningList.Add(factionWarning);

            string warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1);

            foreach (Client target in NAPI.Pools.GetAllPlayers())
            {
                if (target.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_POLICE && target.GetData(EntityData.PLAYER_ON_DUTY) == 1)
                {
                    target.SendChatMessage(Constants.COLOR_INFO + warnMessage);
                }
            }
        }
Пример #11
0
        public void MorirCommand(Client player)
        {
            // Miramos si está muerto y esperando a ir al hospital
            if (NAPI.Data.HasEntityData(player, EntityData.TIME_HOSPITAL_RESPAWN) == true)
            {
                int totalSeconds = Globals.GetTotalSeconds();

                if (NAPI.Data.GetEntityData(player, EntityData.TIME_HOSPITAL_RESPAWN) <= totalSeconds)
                {
                    // Movemos al jugador al hospital
                    TeleportPlayerToHospital(player);

                    // Eliminamos el timer
                    DestroyDeathTimer(player);

                    // Obtenemos el aviso
                    FactionWarningModel factionWarn = Faction.GetFactionWarnByTarget(player.Value, Constants.FACTION_EMERGENCY);

                    if (factionWarn != null)
                    {
                        // Miramos si está atendido el aviso
                        if (factionWarn.takenBy >= 0)
                        {
                            Client doctor = Globals.GetPlayerById(factionWarn.takenBy);
                            NAPI.Chat.SendChatMessageToPlayer(doctor, Constants.COLOR_INFO + Messages.INF_FACTION_WARN_CANCELED);
                        }

                        // Borramos el aviso de la lista
                        Faction.factionWarningList.Remove(factionWarn);
                    }
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_DEATH_TIME_NOT_PASSED);
                }
            }
            else
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_DEAD);
            }
        }
Пример #12
0
        public void DieCommand(Client player)
        {
            // Check if the player is dead
            if (NAPI.Data.HasEntityData(player, EntityData.TIME_HOSPITAL_RESPAWN) == true)
            {
                int totalSeconds = Globals.GetTotalSeconds();

                if (NAPI.Data.GetEntityData(player, EntityData.TIME_HOSPITAL_RESPAWN) <= totalSeconds)
                {
                    // Move player to the hospital
                    TeleportPlayerToHospital(player);
                    DestroyDeathTimer(player);

                    // Get the report generated with the death
                    FactionWarningModel factionWarn = Faction.GetFactionWarnByTarget(player.Value, Constants.FACTION_EMERGENCY);

                    if (factionWarn != null)
                    {
                        if (factionWarn.takenBy >= 0)
                        {
                            // Tell the player who attended the report it's been canceled
                            Client doctor = Globals.GetPlayerById(factionWarn.takenBy);
                            NAPI.Chat.SendChatMessageToPlayer(doctor, Constants.COLOR_INFO + Messages.INF_FACTION_WARN_CANCELED);
                        }

                        // Remove the report from the list
                        Faction.factionWarningList.Remove(factionWarn);
                    }
                }
                else
                {
                    NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_INFO + Messages.INF_DEATH_TIME_NOT_PASSED);
                }
            }
            else
            {
                NAPI.Chat.SendChatMessageToPlayer(player, Constants.COLOR_ERROR + Messages.ERR_PLAYER_NOT_DEAD);
            }
        }
Пример #13
0
        public void DieCommand(Client player)
        {
            // Check if the player is dead
            if (player.GetData(EntityData.TIME_HOSPITAL_RESPAWN) != null)
            {
                int totalSeconds = Globals.GetTotalSeconds();

                if (player.GetData(EntityData.TIME_HOSPITAL_RESPAWN) <= totalSeconds)
                {
                    // Move player to the hospital
                    TeleportPlayerToHospital(player);

                    // Get the report generated with the death
                    FactionWarningModel factionWarn = Faction.GetFactionWarnByTarget(player.Value, Constants.FACTION_EMERGENCY);

                    if (factionWarn != null)
                    {
                        if (factionWarn.takenBy >= 0)
                        {
                            // Tell the player who attended the report it's been canceled
                            Client doctor = Globals.GetPlayerById(factionWarn.takenBy);
                            doctor.SendChatMessage(Constants.COLOR_INFO + InfoRes.faction_warn_canceled);
                        }

                        // Remove the report from the list
                        Faction.factionWarningList.Remove(factionWarn);
                    }
                }
                else
                {
                    player.SendChatMessage(Constants.COLOR_INFO + InfoRes.death_time_not_passed);
                }
            }
            else
            {
                player.SendChatMessage(Constants.COLOR_ERROR + ErrRes.player_not_dead);
            }
        }
Пример #14
0
        public void OnPlayerDeath(Client player, Client killer, uint weapon)
        {
            if (player.GetSharedData(EntityData.PLAYER_KILLED) == 0)
            {
                DeathModel death = new DeathModel(player, killer, weapon);

                Vector3 deathPosition = null;
                string  deathPlace    = string.Empty;
                string  deathHour     = DateTime.Now.ToString("h:mm:ss tt");

                // Checking if player died into a house or business
                if (player.GetData(EntityData.PLAYER_HOUSE_ENTERED) > 0)
                {
                    int        houseId = player.GetData(EntityData.PLAYER_HOUSE_ENTERED);
                    HouseModel house   = House.GetHouseById(houseId);
                    deathPosition = house.position;
                    deathPlace    = house.name;
                }
                else if (player.GetData(EntityData.PLAYER_BUSINESS_ENTERED) > 0)
                {
                    int           businessId = player.GetData(EntityData.PLAYER_BUSINESS_ENTERED);
                    BusinessModel business   = Business.GetBusinessById(businessId);
                    deathPosition = business.position;
                    deathPlace    = business.name;
                }
                else
                {
                    deathPosition = player.Position;
                }

                if (killer.Value == Constants.ENVIRONMENT_KILL || killer == player)
                {
                    // We add the report to the list
                    FactionWarningModel factionWarning = new FactionWarningModel(Constants.FACTION_EMERGENCY, player.Value, deathPlace, deathPosition, -1, deathHour);
                    Faction.factionWarningList.Add(factionWarning);

                    // Report message
                    string warnMessage = string.Format(InfoRes.emergency_warning, Faction.factionWarningList.Count - 1);

                    // Sending the report to all the emergency department's members
                    foreach (Client target in NAPI.Pools.GetAllPlayers())
                    {
                        if (target.GetData(EntityData.PLAYER_FACTION) == Constants.FACTION_EMERGENCY && target.GetData(EntityData.PLAYER_ON_DUTY) > 0)
                        {
                            target.SendChatMessage(Constants.COLOR_INFO + warnMessage);
                        }
                    }

                    // Create the emergency report
                    CreateEmergencyReport(death);
                }
                else
                {
                    int killerId = killer.GetData(EntityData.PLAYER_SQL_ID);
                    player.SetSharedData(EntityData.PLAYER_KILLED, killerId);
                }

                // Time to let player accept his dead
                player.SetData(EntityData.TIME_HOSPITAL_RESPAWN, Globals.GetTotalSeconds() + 240);

                // Set the player into dead state
                player.TriggerEvent("togglePlayerDead", true);
            }
        }