コード例 #1
0
ファイル: FeexHitman.cs プロジェクト: Pustalorc/FeexHitman
        private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause,
                                                        SDG.Unturned.ELimb limb, CSteamID murderer)
        {
            var UPmurderer = UnturnedPlayer.FromCSteamID(murderer);

            try
            {
                if (player.Id == UPmurderer.Id)
                {
                    return;
                }
            }
            catch
            {
                return;
            }

            decimal BountyPercentage = 0;

            foreach (var playerPermission in UPmurderer.GetPermissions())
            {
                if (playerPermission.Name.ToLower().Contains("hitman.receive."))
                {
                    var BountyPermission = playerPermission.Name.ToLower().Replace("hitman.receive.", string.Empty);

                    decimal BountyPercentagePermission;
                    var     isPercentageNumeric = decimal.TryParse(BountyPermission, out BountyPercentagePermission);
                    if (!isPercentageNumeric)
                    {
                        Logger.LogError(BountyPermission + " is not numeric.");
                        return;
                    }

                    if (BountyPercentagePermission > BountyPercentage)
                    {
                        BountyPercentage = BountyPercentagePermission;
                    }
                }
            }

            if (BountyPercentage != 0)
            {
                if (Instance.FeexHitmanDatabase.CheckExists(player.CSteamID))
                {
                    var amount = Instance.FeexHitmanDatabase.GetBounty(player.CSteamID);
                    amount = System.Math.Round(amount * (BountyPercentage / 100), 2);
                    Uconomy.Instance.Database.IncreaseBalance(UPmurderer.Id, amount);
                    Instance.FeexHitmanDatabase.RemoveVictimAccount(player.CSteamID);
                    if (Instance.Translations.Instance.Translate("hitman_general_chat_received") !=
                        "hitman_general_chat_received")
                    {
                        UnturnedChat.Say(
                            Instance.Translations.Instance.Translate("hitman_general_chat_received",
                                                                     UPmurderer.CharacterName, player.CharacterName, amount.ToString(), BountyPercentage),
                            UnityEngine.Color.yellow);
                    }
                }
            }
        }
コード例 #2
0
ファイル: Reputation.cs プロジェクト: SeussCZ/Reputation
 private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, CSteamID kiler)
 {
     if (kiler == player.CSteamID)
     {
     }
     else
     {
         int vRep = Instance.Database.GetReputation(player.ToString());
         int p    = Instance.Configuration.Instance.ReputationForKill;
         if (vRep < 0)
         {
             int rep = Instance.Database.AddRep(kiler.ToString(), p);
             UnturnedChat.Say(kiler, Instance.Translations.Instance.Translate("rep_kill_b", rep));
         }
         else
         {
             int rep = Instance.Database.RemoveRep(kiler.ToString(), p);
             UnturnedChat.Say(kiler, Instance.Translations.Instance.Translate("rep_kill_c", rep));
         }
     }
 }
コード例 #3
0
 private void UnturnedPlayerEvents_OnPlayerDeath(UnturnedPlayer player, SDG.Unturned.EDeathCause cause, SDG.Unturned.ELimb limb, CSteamID murderer)
 {
     if (Configuration.Instance.KickForAnyDeath)
     {
         StartCoroutine(DeathKick(player));
     }
     if (Configuration.Instance.KickOnSucide)
     {
         if (cause.ToString() == "SUCIDE")
         {
             StartCoroutine(DeathKick(player));
         }
     }
 }