private void OnPlayerDeathHandler(Client client, NetHandle entityKiller, int weapon) { InterfaceService.ScreenService.PlayScreenEffect(client, "DeathFailOut", 10000, true); InterfaceService.ScreenService.SetHudVisible(client, false); API.sendNativeToPlayer(client, Hash._RESET_LOCALPLAYER_STATE, client); API.sendNativeToPlayer(client, Hash.RESET_PLAYER_ARREST_STATE, client); API.sendNativeToPlayer(client, Hash.IGNORE_NEXT_RESTART, true); API.sendNativeToPlayer(client, Hash._DISABLE_AUTOMATIC_RESPAWN, true); API.sendNativeToPlayer(client, Hash.SET_FADE_IN_AFTER_DEATH_ARREST, true); API.sendNativeToPlayer(client, Hash.SET_FADE_OUT_AFTER_DEATH, false); API.sendNativeToPlayer(client, Hash.NETWORK_REQUEST_CONTROL_OF_ENTITY, client); API.sendNativeToPlayer(client, Hash.FREEZE_ENTITY_POSITION, client, false); API.sendNativeToPlayer(client, Hash.NETWORK_RESURRECT_LOCAL_PLAYER, client.position.X, client.position.Y, client.position.Z, client.rotation.Z, false, false); API.sendNativeToPlayer(client, Hash.RESURRECT_PED, client); API.triggerClientEvent(client, "EMS_SetPedToRagdoll", true); client.invincible = true; if (!client.hasData("player")) { return; } Player player = client.getData("player"); player.Character.IsDeath = true; if (IsMedicOnline()) { Blip blip = API.createBlip(client); blip.sprite = 305; blip.color = 1; blip.name = $"Dispatch: In mortal danger! | {player.Character.FirstName} {player.Character.LastName}"; Dispatches.Add( new Dispatch { Client = client, Player = player, Time = DateTime.Now, Blip = blip }); BlipService.BlipService.BlipList.Add(blip); StartDeathTimer(client, 600); // Medic is Online Respawn is in 10 Minutes } else { StartDeathTimer(client, 30); // No Medic is Online Respawn in 30 Seconds } }
public bool HasUserBeenDispatched(string userId) { if (Dispatches != null && Dispatches.Any()) { var dispatch = from d in Dispatches where d.UserId == userId select d; if (dispatch != null && dispatch.Any()) { return(true); } } return(false); }
public bool HasAnyDispatches() { if (Dispatches != null && Dispatches.Any()) { return(true); } if (GroupDispatches != null && GroupDispatches.Any()) { return(true); } if (UnitDispatches != null && UnitDispatches.Any()) { return(true); } if (RoleDispatches != null && RoleDispatches.Any()) { return(true); } return(false); }