private string TranslateLimb(ELimb limb) { switch (limb) { case ELimb.SKULL: return(EssLang.LIMB_HEAD.GetMessage()); case ELimb.LEFT_HAND: case ELimb.RIGHT_HAND: case ELimb.LEFT_ARM: case ELimb.RIGHT_ARM: return(EssLang.LIMB_ARM.GetMessage()); case ELimb.LEFT_FOOT: case ELimb.RIGHT_FOOT: case ELimb.LEFT_LEG: case ELimb.RIGHT_LEG: return(EssLang.LIMB_LEG.GetMessage()); case ELimb.SPINE: return(EssLang.LIMB_TORSO.GetMessage()); default: return("?"); } }
void KitPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { var globalKitCooldown = EssCore.Instance.Config.Kit.GlobalCooldown; if (CommandKit.GlobalCooldown.ContainsKey(player.CSteamID.m_SteamID) && EssCore.Instance.Config.Kit.ResetGlobalCooldownWhenDie) { CommandKit.GlobalCooldown[player.CSteamID.m_SteamID] = DateTime.Now.AddSeconds(-globalKitCooldown); } if (!CommandKit.Cooldowns.ContainsKey(player.CSteamID.m_SteamID)) { return; } var playerCooldowns = CommandKit.Cooldowns[player.CSteamID.m_SteamID]; var keys = new List <string> (playerCooldowns.Keys); foreach (var kitName in keys) { var kit = KitModule.Instance.KitManager.GetByName(kitName); if (kit == null) { playerCooldowns.Remove(kitName); continue; } if (kit.ResetCooldownWhenDie) { playerCooldowns[kitName] = DateTime.Now.AddSeconds(-kit.Cooldown); } } }
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { string path = directory + "/Staff-Kills.txt"; List<string> Staff = new List<string>(Configuration.Instance.StaffGroups); if (Configuration.Instance.ChatAnnounce == true) { if (!(player is UnturnedPlayer)) { return; } else { UnturnedPlayer killer = (UnturnedPlayer)UnturnedPlayer.FromCSteamID(murderer); foreach (RocketPermissionsGroup pGroup in R.Permissions.GetGroups(killer, true)) { if (Configuration.Instance.StaffGroups.Contains(pGroup.Id)) { if (killer.Features.GodMode) { UnturnedChat.Say(player.DisplayName + " was killed by: " + killer.DisplayName + ". They were in: God Mode!"); File.AppendAllText(path, DateTime.Now.ToString() + "[##GOD ABUSE##]" + player.DisplayName + " was killed by " + killer.DisplayName + " ID: " + killer.CSteamID + "." + System.Environment.NewLine); return; } else if (killer.Features.VanishMode) { UnturnedChat.Say(player.DisplayName + " was killed by: " + killer.DisplayName + ". They were in: Vanish Mode!"); File.AppendAllText(path, DateTime.Now.ToString() + "[##VANISH ABUSE##]" + player.DisplayName + " was killed by " + killer.DisplayName + " ID: " + killer.CSteamID + "." + System.Environment.NewLine); return; } else if (killer.Features.GodMode && killer.Features.VanishMode) { UnturnedChat.Say(player.DisplayName + " was killed by: " + killer.DisplayName + ". They were in: God Mode and Vanish Mode!"); File.AppendAllText(path, DateTime.Now.ToString() + "[##GOD AND VANISH ABUSE##]" + player.DisplayName + " was killed by " + killer.DisplayName + " ID: " + killer.CSteamID + "." + System.Environment.NewLine); return; } else { return; } } } } } }
public static RaycastInfo GenerateRaycast(GameObject Object, Vector3 Point, Collider col) { ELimb Limb = RaycastOptions.TargetLimb; if (RaycastOptions.UseRandomLimb) { ELimb[] Limbs = (ELimb[])Enum.GetValues(typeof(ELimb)); Limb = Limbs[MathUtilities.Random.Next(0, Limbs.Length)]; } EPhysicsMaterial mat = col == null ? EPhysicsMaterial.NONE : DamageTool.getMaterial(Point, Object.transform, col); if (RaycastOptions.UseTargetMaterial) { mat = RaycastOptions.TargetMaterial; } return(new RaycastInfo(Object.transform) { point = Point, direction = RaycastOptions.UseModifiedVector ? RaycastOptions.TargetRagdoll.ToVector() : OptimizationVariables.MainPlayer.look.aim.forward, limb = Limb, material = mat, player = Object.GetComponent <Player>(), zombie = Object.GetComponent <Zombie>(), vehicle = Object.GetComponent <InteractableVehicle>() }); }
private async void SaveDeathLocation(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator) { var userData = await m_UserDataStore.GetUserDataAsync(sender.player.channel.owner.playerID.steamID.ToString(), "player"); userData.Data["deathLocation"] = sender.transform.position.ToSerializableVector3(); await m_UserDataStore.SetUserDataAsync(userData); }
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, Steamworks.CSteamID murderer) { var mplayer = UnturnedPlayer.FromCSteamID(murderer); if (cause.ToString() == "GUN") { if (limb == ELimb.SKULL) { mplayer.Experience = mplayer.Experience + Main.Instance.Configuration.Instance.HsXp4Kill; UnturnedChat.Say(mplayer, String.Format(Translate("RewardForXp"), player.DisplayName, Main.Instance.Configuration.Instance.HsXp4Kill)); } else { mplayer.Experience = mplayer.Experience + Main.Instance.Configuration.Instance.Xp4Kill; UnturnedChat.Say(mplayer, String.Format(Translate("RewardForXp"), player.DisplayName, Main.Instance.Configuration.Instance.Xp4Kill)); } } else if (cause.ToString() == "MELEE") { if (limb == ELimb.SKULL) { mplayer.Experience = mplayer.Experience + Main.Instance.Configuration.Instance.HsXp4Kill; UnturnedChat.Say(mplayer, String.Format(Translate("RewardForXp"), player.DisplayName, Main.Instance.Configuration.Instance.HsXp4Kill)); } else { mplayer.Experience = mplayer.Experience + Main.Instance.Configuration.Instance.Xp4Kill; UnturnedChat.Say(mplayer, String.Format(Translate("RewardForXp"), player.DisplayName, Main.Instance.Configuration.Instance.Xp4Kill)); } } }
private void OnPlayerDeath(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator) { var player = GetUnturnedPlayer(sender.player) !; var @event = new UnturnedPlayerDeathEvent(player, cause, limb, instigator); Emit(@event); }
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { List <ItemJar> droppedInventory = new List <ItemJar>(); UnityEngine.Vector3 deathlocation = player.Position + new UnityEngine.Vector3(0, (float)0.60, 0); moveInventoryItems(player, droppedInventory); if (Instance.Configuration.Instance.StoreClothes) { removeClothing(player, droppedInventory); } // use the specified unturned storage asset Barricade deathBag = new Barricade(Instance.Configuration.Instance.DeathBagId); UnityEngine.Transform barricadeTransform = new UnityEngine.GameObject().transform; barricadeTransform.localPosition = deathlocation; // create the physical bag to be dropped into the scene InteractableStorage deathBagStorage = BarricadeManager.dropBarricade(deathBag, barricadeTransform, deathlocation, 0, 0, 0, 0, 0).GetComponent <InteractableStorage>(); foreach (ItemJar itemjar in droppedInventory) { // add the inventory into the bag deathBagStorage.items.tryAddItem(itemjar.item); } TaskDispatcher.QueueOnMainThread(() => { DamageTool.damage(deathBagStorage.transform, false, 100000, 1, out EPlayerKill kill); }, (float)Instance.Configuration.Instance.Delay); }
private static void OnPlayerDied(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator) { var killedSteamPlayer = sender.channel.owner; var combat = CombatManager.CombatTracker.ContainsKey(killedSteamPlayer) ? CombatManager.CombatTracker[killedSteamPlayer] : null; if (combat != null && PlayerTool.getSteamPlayer(instigator) == null && DateTimeOffset.UtcNow.ToUnixTimeMilliseconds() - combat.LastHit < Main.Config.CombatExpiration) { instigator = combat.Aggressor.playerID.steamID; } var killInfo = new PlayerDeath(killedSteamPlayer, instigator, cause); var killer = PlayerTool.getSteamPlayer(instigator); if (killer != null) { killInfo.KillerShotsHit = CombatManager.Accuracies.ContainsKey(killer) ? CombatManager.Accuracies[killer].ShotsHit : 0; killInfo.KillerShotsFired = CombatManager.Accuracies.ContainsKey(killer) ? CombatManager.Accuracies[killer].ShotsFired : 0; UnityThread.executeCoroutine(CaptureScreen(killInfo, killer)); } else { var socketData = new SocketData("PlayerDeath", JsonConvert.SerializeObject(killInfo)); SocketManager.Emit(socketData); } }
public static string CheckLimb(ELimb limb) { string limbd; if (limb.ToString() == "LEFT_BACK" || limb.ToString() == "LEFT_FRONT" || limb.ToString() == "RIGHT_BACK" || limb.ToString() == "RIGHT_FRONT" || limb.ToString() == "SPINE") { limbd = "body"; return(limbd); } else if (limb.ToString() == "SKULL") { limbd = "head"; return(limbd); } else if (limb.ToString() == "LEFT_FOOT" || limb.ToString() == "LEFT_LEG" || limb.ToString() == "RIGHT_FOOT" || limb.ToString() == "RIGHT_LEG") { limbd = "leg"; return(limbd); } else if (limb.ToString() == "LEFT_ARM" || limb.ToString() == "LEFT_HAND" || limb.ToString() == "RIGHT_ARM" || limb.ToString() == "RIGHT_HAND") { limbd = "arm"; return(limbd); } else { return(limbd = "unknown"); } }
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { ItemManager.askClearRegionItems(player.Player.movement.region_x, player.Player.movement.region_y); if (Commands.Command_AutoSave.AutoSave.ContainsKey(player.CSteamID)) { string kitName = Commands.Command_AutoSave.AutoSave[player.CSteamID]; KitManager.SaveKit(player, player, kitName, KitManager.AutoSaveKits); } if (Commands.Command_AutoCopy.Murdered.ContainsKey(player.CSteamID)) { Commands.Command_AutoCopy.Murdered.Remove(player.CSteamID); } if (Configuration.Instance.KeepKitsOnDeath == false) { KitManager.DeleteKit(player, "*", KitManager.Kits); } IRocketPlayer mMurderer = UnturnedPlayer.FromCSteamID(murderer); if (!(mMurderer is ConsolePlayer)) { Commands.Command_AutoCopy.Murdered.Add(player.CSteamID, murderer); } }
static string TranslateLimb(ELimb limb) { switch (limb) { case ELimb.SKULL: return(EssLang.Translate("LIMB_HEAD")); case ELimb.LEFT_HAND: case ELimb.RIGHT_HAND: case ELimb.LEFT_ARM: case ELimb.RIGHT_ARM: return(EssLang.Translate("LIMB_ARM")); case ELimb.LEFT_FOOT: case ELimb.RIGHT_FOOT: case ELimb.LEFT_LEG: case ELimb.RIGHT_LEG: return(EssLang.Translate("LIMB_LEG")); case ELimb.SPINE: return(EssLang.Translate("LIMB_TORSO")); //TODO: Add case ELimb.LEFT_BACK: case ELimb.RIGHT_BACK: case ELimb.LEFT_FRONT: case ELimb.RIGHT_FRONT: return("?"); default: return("?"); } }
void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { UnturnedPlayer untKiller = UnturnedPlayer.FromCSteamID(murderer); // Remove any of those pesky errors if (untKiller?.Player != null) { if (Utils.IsActive(untKiller)) { if (untKiller.GodMode) { if (Config.PlayerDamagePublicWarn) { Utils.Announce(Translate("public_killed_in_god", untKiller.DisplayName)); } } if (untKiller.VanishMode) { if (Config.PlayerDamagePublicWarn) { Utils.Announce(Translate("public_killed_in_vanish", untKiller.DisplayName, player.DisplayName)); } } } } }
public void onDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (Instance.Configuration.Instance.Points) { ArenaPlayer aplayer = new ArenaPlayer(player.SteamPlayer()); if (LevelManager.arenaPlayers.Contains(aplayer)) { if (LevelManager.arenaPlayers.Count == 5) { //fifth place UnturnedChat.Say("Tourney>> " + player + "[5th] +" + Instance.Configuration.Instance.fifthPoint.ToString(), Color.cyan); UpdatePoints(player, Instance.Configuration.Instance.fifthPoint); } else if (LevelManager.arenaPlayers.Count == 4) { UnturnedChat.Say("Tourney>> " + player + "[4th] +" + Instance.Configuration.Instance.fourthpoint.ToString(), Color.cyan); UpdatePoints(player, Instance.Configuration.Instance.fourthpoint); } else if (LevelManager.arenaPlayers.Count == 3) { UnturnedChat.Say("Tourney>> " + player + "[3rd] +" + Instance.Configuration.Instance.thirdpoint.ToString(), Color.cyan); UpdatePoints(player, Instance.Configuration.Instance.thirdpoint); } else if (LevelManager.arenaPlayers.Count == 2) { UnturnedChat.Say("Tourney>> " + player + "[2nd] +" + Instance.Configuration.Instance.secondpoint.ToString(), Color.cyan); UpdatePoints(player, Instance.Configuration.Instance.secondpoint); } } } }
private void OnPlayerDied(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator) { if (EscortingPlayers.ContainsKey(sender.player.channel.owner.playerID.steamID)) { CSteamID escorteeID; if (!EscortingPlayers.TryGetValue(sender.player.channel.owner.playerID.steamID, out escorteeID)) { return; } EscortingPlayers.Remove(sender.player.channel.owner.playerID.steamID); EscortedPlayers.Remove(escorteeID); } else if (EscortedPlayers.ContainsKey(sender.player.channel.owner.playerID.steamID)) { CSteamID escorterID; if (!EscortedPlayers.TryGetValue(sender.player.channel.owner.playerID.steamID, out escorterID)) { return; } EscortedPlayers.Remove(sender.player.channel.owner.playerID.steamID); EscortingPlayers.Remove(escorterID); } }
private void FreezePlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (UEssentials.Config.UnfreezeOnDeath && player.GetComponent <FrozenPlayer>() != null) { UnityEngine.Object.Destroy(player.GetComponent <FrozenPlayer>()); } }
public EPlayerKill Damage(byte amount, Vector3 direction, EDeathCause cause, ELimb limb, CSteamID damageDealer) { EPlayerKill playerKill; player.PlayerLife.askDamage(amount, direction, cause, limb, damageDealer, out playerKill); return(playerKill); }
// Token: 0x06001E6A RID: 7786 RVA: 0x000A6700 File Offset: 0x000A4B00 public float multiply(ELimb limb) { switch (limb) { case ELimb.LEFT_BACK: return(this.damage * this.leg * Provider.modeConfigData.Animals.Armor_Multiplier); case ELimb.RIGHT_BACK: return(this.damage * this.leg * Provider.modeConfigData.Animals.Armor_Multiplier); case ELimb.LEFT_FRONT: return(this.damage * this.leg * Provider.modeConfigData.Animals.Armor_Multiplier); case ELimb.RIGHT_FRONT: return(this.damage * this.leg * Provider.modeConfigData.Animals.Armor_Multiplier); case ELimb.SPINE: return(this.damage * this.spine * Provider.modeConfigData.Animals.Armor_Multiplier); case ELimb.SKULL: return(this.damage * this.skull * Provider.modeConfigData.Animals.Armor_Multiplier); default: return(this.damage); } }
//This is to prevent other plugins overwriting god mode by accident private void OnPlayerDamaged(UnturnedPlayer player, ref EDeathCause cause, ref ELimb limb, ref UnturnedPlayer killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) { if (player.GodMode) { return; } var untPlayer = PlayerUtil.GetUnturnedPlayer(player); var currentRegion = GetRegionAt(untPlayer.Position); if (currentRegion == null) { return; //No region? Not our problem! } //Flag is stop the process of this function because the user opted to disabled the auto-protection feature if (currentRegion.Flags.Exists(fg => fg.Name.Equals("DisableGodModeProtection", StringComparison.OrdinalIgnoreCase))) { return; } try //This is just here to prevent the console logging at a lot of errors because exceptions will be generated by using this way { if (currentRegion != null) { OnPlayerEnteredRegion(player, currentRegion); } } catch (Exception) { } }
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (CombatPlayers.TryGetValue(player.CSteamID.m_SteamID, out Timer timer) && timer.Enabled) { timer.Dispose(); CombatPlayers.Remove(player.CSteamID.m_SteamID); } }
public UnturnedPlayerDamagedEvent(IPlayer player, EDeathCause deathCause, ELimb limb, IUser damageDealer, Vector3 direction, float damage, float times, EventExecutionTargetContext executionTarget = EventExecutionTargetContext.Sync, bool global = true) : base(player, damage, damageDealer, executionTarget, global) { DeathCause = deathCause; Limb = limb; Direction = direction; Damage = damage; Times = times; }
public UnturnedPlayerDamagedEvent(UnturnedPlayer player, byte damageAmount, EDeathCause cause, ELimb limb, CSteamID killer, IDamageSource damageSource) : base(player) { DamageAmount = damageAmount; Cause = cause; Limb = limb; Killer = killer; DamageSource = damageSource; }
public UnturnedPlayerDamagedEvent(IPlayer player, EDeathCause deathCause, ELimb limb, IUser damageDealer, Vector3 direction, float damage, float times) : base(player, damage, damageDealer) { DeathCause = deathCause; Limb = limb; Direction = direction; Damage = damage; Times = times; }
public static void Prefix(byte amount, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, bool canCauseBleeding, PlayerLife __instance) { if (PlayerTool.getSteamPlayer(newKiller) == null) { return; } CombatManager.CombatTracker[__instance.channel.owner] = new Combat(DateTimeOffset.UtcNow.ToUnixTimeMilliseconds(), PlayerTool.getSteamPlayer(newKiller)); }
public UnturnedPlayerDyingEvent(UnturnedPlayer player, byte amount, EDeathCause cause, ELimb limb, CSteamID killer, IDamageSource source, bool trackKill, Vector3 ragdoll, ERagdollEffect ragdollEffect, bool canCauseBleeding) : base(player, amount, cause, limb, killer, source, trackKill, ragdoll, ragdollEffect, canCauseBleeding) { }
static void onDamage(SDG.Unturned.Player player, ref EDeathCause cause, ref ELimb limb, ref CSteamID killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) { if (OnPlayerDamaged != null && player != null && killer != CSteamID.Nil && killer != null) { UnturnedPlayer getterDamage = UnturnedPlayer.FromPlayer(player); UnturnedPlayer senderDamage = UnturnedPlayer.FromCSteamID(killer); OnPlayerDamaged.TryInvoke(getterDamage, cause, limb, senderDamage, direction, damage, times, canDamage); } }
private void BackPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (!player.HasPermission("essentials.command.back")) { return; } UPlayer.TryGet(player, p => p.SetMetadata(Consts.BACK_METADATA_KEY, player.Position)); }
private void OnPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { //Check for enable is pointless here, if it were disabled the event is never subscribed ushort[] Effects = Instance.Configuration.Instance.Effects.ToArray(); for (int i = 0; i < Effects.Length; i++) { player.TriggerEffect(Effects[i]); } }
private void Death(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { var found = RunningRobberies.SingleOrDefault(c => c.Robber.channel.owner.playerID.steamID == player.CSteamID); if (found == null) { return; } Fail(found); }
private void OnPlayerDamaged(Player player, ref EDeathCause cause, ref ELimb limb, ref CSteamID killer, ref Vector3 direction, ref float damage, ref float times, ref bool canDamage) { var killerPlayer = PlayerTool.getSteamPlayer(killer); if (killerPlayer != null && !Configuration.Instance.AllowCombat) { this.StartPlayerCombat(killer); this.StartPlayerCombat(player.channel.owner.playerID.steamID); } }
private void ClearInventory(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { if (!player.HasPermission ("keepinventory.keep")) { return; } var playerInventory = player.Inventory; List<Item> ids = new List<Item> (); List<Item> clothes = new List<Item> (); // "Remove "models" of items from player "body"" player.Player.channel.send ("tellSlot", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, ( byte ) 0, ( byte ) 0, new byte[0]); player.Player.channel.send ("tellSlot", ESteamCall.ALL, ESteamPacket.UPDATE_RELIABLE_BUFFER, ( byte ) 1, ( byte ) 0, new byte[0]); // Remove items for (byte page = 0; page < 8; page++) { var count = playerInventory.getItemCount (page); for (byte index = 0; index < count; index++) { ids.Add (playerInventory.getItem (page, 0).item); playerInventory.removeItem (page, 0); } } // Unequip & remove from inventory player.Player.clothing.askWearBackpack (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearGlasses (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearHat (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearPants (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearMask (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearShirt (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); player.Player.clothing.askWearVest (0, 0, new byte[0], true); clothes.Add (removeUnequipped (playerInventory)); clothes.AddRange (ids); deadAdmins.Add (player); adminItems.Add (player, clothes); }
internal void OnPlayerDeath( UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer ) { if ( !player.HasPermission( "essentials.command.back" ) ) return; var displayName = player.DisplayName; if ( BackDict.ContainsKey( displayName ) ) BackDict.Remove( displayName ); BackDict.Add( displayName, player.Position ); }
public static bool PlayerDamaged(Player player, ref byte amount, ref Vector3 ragdoll, ref EDeathCause deathCause, ref ELimb limb, CSteamID killer, object attacker) { uint uintAmount = amount; bool cancelled = PlayerDamaged(player, ref uintAmount, ref ragdoll, ref deathCause, ref limb, killer, attacker, false); amount = (byte)uintAmount; return cancelled; }
private void onPlayerDeath(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer) { UnturnedPlayer killer = DGPlugin.getKiller(player, cause, murderer); if (killer != null) { if(scores.ContainsKey(killer.CSteamID)) //update score of killing player scores[killer.CSteamID]++; else if(!killer.IsAdmin) { //kill the player and remove 10 of their credits killer.Damage(100, killer.Position, EDeathCause.KILL, ELimb.SPINE, player.CSteamID); Currency.changeBalance(killer, -10); DGPlugin.messagePlayer(killer, "Don't interfere with Arena. You have lost 10 credits."); } } if (deaths.ContainsKey(player.CSteamID)) { //update the deaths of the victim deaths[player.CSteamID]++; //clear their inventory so that they don't drop anything PlayerState.clearInventory(player); //respawn player LifeUpdated playerDied = null; playerDied = delegate(bool isDead) { if (isDead) DGPlugin.respawnPlayer(player); player.Player.PlayerLife.OnUpdateLife -= playerDied; }; player.Player.PlayerLife.OnUpdateLife += playerDied; } }
internal void OnPlayerDeath( UnturnedPlayer player,EDeathCause cause, ELimb limb, CSteamID murderer ) { if ( !Cooldowns.ContainsKey( player.CSteamID.m_SteamID ) ) return; var playerCooldowns = Cooldowns[player.CSteamID.m_SteamID]; foreach ( var kitName in playerCooldowns.Keys ) { var kit = EssProvider.KitManager.GetByName(kitName); if ( kit.ResetCooldownWhenDie ) playerCooldowns[kitName] = DateTime.Now.AddSeconds( -kit.Cooldown ); } }
public static bool PlayerDamaged(Player player, ref uint amount, ref Vector3 ragdoll, ref EDeathCause deathCause, ref ELimb limb, CSteamID killer, object attacker, bool fromUFM) { TemplateObject attackerTag = null; if (killer != null && killer != CSteamID.Nil && killer != Provider.server) { SteamPlayer steamkiller = PlayerTool.getSteamPlayer(killer); if (steamkiller != null) { attackerTag = new PlayerTag(steamkiller); } } else if (attacker != null) { if (attacker is Animal) { attackerTag = new AnimalTag((Animal)attacker); } else if (attacker is Zombie) { attackerTag = new ZombieTag((Zombie)attacker); } } PlayerTag playerTag = new PlayerTag(player.channel.owner); UFMHealthController healthController = player.gameObject.GetComponent<UFMHealthController>(); uint health = healthController != null ? healthController.health : player.life.health; if (amount >= health) { PlayerDeathEventArgs deathevt = new PlayerDeathEventArgs(); deathevt.Player = playerTag; deathevt.Amount = new NumberTag(amount); deathevt.Cause = new TextTag(deathCause.ToString()); deathevt.Limb = new TextTag(limb.ToString()); deathevt.Killer = attackerTag; UnturnedFreneticEvents.OnPlayerDeath.Fire(deathevt); amount = (uint)deathevt.Amount.Internal; if (!deathevt.Cancelled && !EntityDeath(playerTag, ref amount) && healthController != null) { healthController.Damage(amount); player.life.ragdoll = ragdoll; amount = (uint)(((double)amount / healthController.maxHealth) * 100.0); return false; } return true; } PlayerDamagedEventArgs evt = new PlayerDamagedEventArgs(); evt.Player = playerTag; evt.Amount = new NumberTag(amount); evt.Attacker = attackerTag; UnturnedFreneticEvents.OnPlayerDamaged.Fire(evt); amount = (uint)evt.Amount.Internal; if (!evt.Cancelled && !EntityDamaged(playerTag, ref amount) && healthController != null) { healthController.Damage(amount); player.life.ragdoll = ragdoll; amount = (uint)(((double)amount / healthController.maxHealth) * 100.0); return false; } return true; }