Example #1
0
        public static void Prefix(byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, ERagdollEffect newRagdollEffect, bool canCauseBleeding, PlayerLife __instance)
        {
            Player ply = __instance.channel.owner.player;
            if (ply is null) return;

            if (amount >= ply.life.health)
            {
                Transform deathboxTransform = BarricadeManager.dropBarricade(new Barricade(1283),ply.transform, ply.transform.position, 0f, 0f, 0f, (ulong) ply.channel.owner.playerID.steamID, 0UL);
                byte x;
                byte y;
                ushort plant;
                ushort index;
                BarricadeRegion region;

                if (!BarricadeManager.tryGetInfo(deathboxTransform, out x, out y, out plant, out index, out region)) return;

                InteractableStorage storage = deathboxTransform.GetComponent<InteractableStorage>();
                storage.items.resize(10, 10);

                for (byte page = 0; page < 6; page++)
                {
                    for (byte i = 0; i < ply.inventory.items[page].getItemCount(); i++)
                    {
                        ItemJar item = ply.inventory.items[page].getItem(i);
                        storage.items.tryAddItem(item.item);
                    }
                }
                TTTPlayer.ClearInventoryUnsafe(__instance.channel.owner); // Clears clothing to prevent players aqquiring detective vest ect.
            }
        }
Example #2
0
        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);
                }
            }
        }
        public PlayerDeath(SteamPlayer killed, CSteamID killerId, EDeathCause deathCause)
        {
            Cause         = Enum.GetName(typeof(EDeathCause), deathCause)?.ToLower();
            KilledSteamId = killed.playerID.steamID.ToString();
            KilledName    = killed.playerID.playerName;
            var killer = PlayerTool.getSteamPlayer(killerId);

            if (killer == null)
            {
                return;
            }
            if (killer.Equals(killed))
            {
                return;
            }

            KillerSteamId = killer.playerID.steamID.ToString();
            KillerName    = killer.playerID.playerName;
            Distance      = Vector3.Distance(killed.player.transform.position, killer.player.transform.position);

            if (killer.player.equipment == null)
            {
                return;
            }
            if (killer.player.equipment.asset != null)
            {
                KillerWeapon = killer.player.equipment.asset.name;
            }
        }
Example #4
0
        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);
        }
Example #5
0
    public bool ShieldProc(EDeathCause cause = EDeathCause.CRUSHED)
    {
        if (shieldCharges < 1)
        {
            return(false);
        }

        Vector3 rayOrigin = transform.position;

        shieldCharges--;

        for (int i = 0; i < 30; i++)
        {
            rayOrigin.y += 2;

            if (!Physics.Raycast(rayOrigin, new Vector3(0, 0, 1), 30))
            {
                transform.position = rayOrigin;
                isOnTheGround      = false;
                canJump            = false;
                TimeAirborne       = 0.0f;
                return(true);
            }
        }

        return(false);

        // You might want to do something special for when you're crushed (temporary invincibility ?)
    }
Example #6
0
        public static void Prefix(byte amount, Vector3 newRagdoll, EDeathCause newCause, ELimb newLimb, CSteamID newKiller, ref EPlayerKill kill, bool trackKill, ERagdollEffect newRagdollEffect, bool canCauseBleeding, PlayerLife __instance)
        {
            Player ply = __instance.channel.owner.player;

            if (ply is null)
            {
                return;
            }

            if (amount >= ply.life.health && ply.clothing.vest == 1013)
            {
                ply.clothing.askWearVest(0, 0, new byte[0], true);
                InventorySearch foundVest = ply.inventory.has(1013);
                if (foundVest is null)
                {
                    return;
                }

                ply.inventory.removeItem(foundVest.page, ply.inventory.getIndex(foundVest.page, foundVest.jar.x, foundVest.jar.y));

                ExplosionParameters explodParams = new ExplosionParameters(ply.transform.position, 10f, EDeathCause.KILL, CSteamID.Nil);
                explodParams.penetrateBuildables = true;
                explodParams.playerDamage        = 150;
                explodParams.damageRadius        = 32;
                explodParams.barricadeDamage     = 1000;
                List <EPlayerKill> deadPlayers = new List <EPlayerKill>();
                EffectManager.sendEffect(45, byte.MaxValue, byte.MaxValue, byte.MaxValue, ply.transform.position);
                DamageTool.explode(explodParams, out deadPlayers);
            }
        }
 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);
             }
         }
     }
 }
Example #8
0
        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 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, 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));
                }
            }
        }
Example #11
0
        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;
                            }
                        }
                    }
                }
            }

        }
        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);
            }
        }
Example #13
0
        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);
            }
        }
Example #14
0
        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));
                        }
                    }
                }
            }
        }
Example #15
0
        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);
            }
        }
Example #16
0
        private void OnPlayerDamaged(SDG.Unturned.Player uPlayer, ref EDeathCause cause, ref ELimb limb, ref CSteamID killerId, ref global::UnityEngine.Vector3 direction, ref float damage, ref float times, ref bool canDamage)
        {
            if (uPlayer == null)
            {
                return;
            }

            playerManager.TryGetOnlinePlayerById(uPlayer.channel.owner.playerID.steamID.ToString(), out var player);
            playerManager.TryGetOnlinePlayerById(killerId.m_SteamID.ToString(), out var killer);

            UnturnedPlayerDamagedEvent damageEvent =
                new UnturnedPlayerDamagedEvent(player, cause, limb, killer?.User, direction.ToSystemVector(), damage, times)
            {
                IsCancelled = !canDamage
            };

            eventManager.Emit(this, damageEvent);
            cause     = damageEvent.DeathCause;
            limb      = damageEvent.Limb;
            killerId  = damageEvent.DamageDealer != null ? new CSteamID(ulong.Parse(damageEvent.DamageDealer.Id)) : CSteamID.Nil;
            direction = damageEvent.Direction.ToUnityVector();
            damage    = (float)damageEvent.Damage;
            times     = damageEvent.Times;
            canDamage = !damageEvent.IsCancelled;
        }
 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>());
     }
 }
Example #18
0
        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);
        }
Example #19
0
        //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) { }
        }
Example #20
0
 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;
 }
Example #21
0
 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;
 }
        internal static void InternalOnPlayerDeath(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator)
        {
            UnturnedPlayerEvents instance = sender.GetComponent <UnturnedPlayerEvents>();
            UnturnedPlayer       rp       = UnturnedPlayer.FromPlayer(sender.player);

            OnPlayerDeath.TryInvoke(rp, cause, limb, instigator);
            instance.OnDeath.TryInvoke(rp, cause, limb, instigator);
        }
Example #23
0
 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;
 }
Example #24
0
 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);
     }
 }
        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));
        }
 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);
     }
 }
Example #27
0
 private void UnturnedPlayerEvents_OnPlayerDead(UnturnedPlayer player, EDeathCause cause, ELimb limb, CSteamID murderer)
 {
     if (this.woundeds.Any((Wounded e) => e.Id == player.CSteamID))
     {
         this.woundeds.Remove(this.woundeds.First((Wounded e) => e.Id == player.CSteamID));
         player.Player.movement.sendPluginSpeedMultiplier(1f);
         this.Temizle(player);
     }
 }
        internal static void InternalOnPlayerDied(PlayerLife sender, EDeathCause cause, ELimb limb, CSteamID instigator)
        {
            UnturnedPlayerEvents instance = sender.GetComponent <UnturnedPlayerEvents>();
            UnturnedPlayer       rp       = UnturnedPlayer.FromPlayer(sender.player);

            // First parameter of tellDead was the "ragdoll" force prior to client adjustments. Unnecessary AFAIK.
            OnPlayerDead.TryInvoke(rp, Vector3.zero);
            instance.OnDead.TryInvoke(rp, Vector3.zero);
        }
        private void OnHurt(Player nativePlayer, byte damage, Vector3 force, EDeathCause cause, ELimb limb, CSteamID killer)
        {
            var player = GetUnturnedPlayer(nativePlayer) !;
            var source = GetDamageSource(killer);

            var @event = new UnturnedPlayerDamagedEvent(player, damage, cause, limb, killer, source);

            Emit(@event);
        }
 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)
 {
 }
Example #31
0
        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);
        }
Example #32
0
        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;
 }
Example #34
0
        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;
 }
        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;
            }
        }