public IEnumerator <float> HealOverTime(ReferenceHub hub, int amount, float duration = 10f) { float amountPerTick = amount / duration; for (int i = 0; i < duration; i++) { if ((hub.GetHealth() + amountPerTick) > hub.playerStats.maxHP) { break; } hub.SetHealth(hub.GetHealth() + amountPerTick); yield return(Timing.WaitForSeconds(1f)); } }
internal void CheckKill(ref PlayerHurtEvent ev, Team team, Team target, ReferenceHub attacker, ReferenceHub player) { if (attacker == null || player == null) { SetAmountZero(ref ev); return; } bool ntf = (target == Team.MTF || target == Team.RSC || ((target == Team.CHI || target == Team.CDP) && player.IsHandCuffed())) && (team == Team.MTF || team == Team.RSC); bool ci = (target == Team.CHI || target == Team.CDP || ((target == Team.MTF || target == Team.RSC) && player.IsHandCuffed())) && (team == Team.CHI || team == Team.CDP); bool scpNear = plugin.useScpNear ? IsScpNearby(player, plugin.maxScpDist) : false; bool inElevator = plugin.useInElevator ? IsNearElevator(player, 20f) : false; if ((ntf || ci)) { if (!teamKills.ContainsKey(attacker.GetUserId())) { teamKills.Add(attacker.GetUserId(), 0); } if (!teamKillTimers.ContainsKey(attacker.GetUserId())) { teamKillTimers.Add(attacker.GetUserId(), 0f); } var curtks = teamKills[attacker.GetUserId()]; if (team == Team.RIP || Time.timeSinceLevelLoad - teamKillTimers[attacker.GetUserId()] <= plugin.TKInterval || scpNear || inElevator || IsTeamSquadNearby(player, team, target, plugin.maxTeamDist)) { SetAmountZero(ref ev); BroadCastToPlayer(attacker, 3, "You cannot teamkill now."); return; } else if (IsPossibleRevenge(ref ev)) { SetAmountZero(ref ev); BroadCastToPlayer(attacker, 3, "You cannot revengekill."); return; } else if (teamKills[attacker.GetUserId()] >= plugin.maxTK) { SetAmountZero(ref ev); BroadCastToPlayer(attacker, 3, "Max teamkills reached."); return; } else if (player.GetHealth() - ev.Amount <= 0f) { teamKills[attacker.GetUserId()]++; attacker.Broadcast(3, "Teamkills Left: " + (plugin.maxTK - (curtks + 1)), false); if (!teamKillTimers.ContainsKey(attacker.GetUserId())) { teamKillTimers.Add(attacker.GetUserId(), Time.timeSinceLevelLoad); } teamKillTimers[attacker.GetUserId()] = Time.timeSinceLevelLoad; var data = new TeamKillCoolDown() { NotRevengeUserId = attacker.GetUserId(), Time = Time.timeSinceLevelLoad, UserId = player.GetUserId() }; teamKillRevengeTimers.Add(data); } } /*else if ((ntf || ci) && (inElevator || scpNear)) * { * ev.Amount = 0f; * BroadCastToPlayer(ev.Attacker, 3, "You cannot teamkill now."); * return; * }*/ }