Skip to content
This repository has been archived by the owner on Aug 10, 2024. It is now read-only.

Commit

Permalink
Fix braindamage
Browse files Browse the repository at this point in the history
  • Loading branch information
ntm5 committed Jul 5, 2024
1 parent 3cc5da1 commit 7e623b1
Showing 1 changed file with 10 additions and 27 deletions.
37 changes: 10 additions & 27 deletions mod/TTT.Roles/RoleManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,41 +67,24 @@ public void Start(BasePlugin parent)

}

if (info.BitsDamageType is 256)
{
if (attacker == null) return HookResult.Continue;

info.Damage = 0;
if (info.BitsDamageType is not 256) return HookResult.Continue;
if (attacker == null) return HookResult.Continue;

var targetRole = GetPlayer(playerWhoWasDamaged);

Server.NextFrame(() =>
{
attacker.PrintToChat(
StringUtils.FormatTTT(
$"You tased player {playerWhoWasDamaged.PlayerName} they are a {targetRole.PlayerRole().FormatRoleFull()}"));
});

_roundService.GetLogsService().AddLog(new MiscAction("tased player " + targetRole.PlayerRole().FormatStringFullAfter(playerWhoWasDamaged.PlayerName), attacker));
info.Damage = 0;

return HookResult.Stop;
}
var targetRole = GetPlayer(playerWhoWasDamaged);

Server.NextFrame(() =>
{
Server.PrintToChatAll("Damage: " + info.Damage + " Health: " + playerWhoWasDamaged.PlayerPawn.Value.Health);
attacker.PrintToChat(
StringUtils.FormatTTT(
$"You tased player {playerWhoWasDamaged.PlayerName} they are a {targetRole.PlayerRole().FormatRoleFull()}"));
});

if (info.Damage < playerWhoWasDamaged.PlayerPawn.Value.Health) return HookResult.Continue;

if (GetPlayer(playerWhoWasDamaged).IsDead()) return HookResult.Continue;

GetPlayer(playerWhoWasDamaged).SetDead(true);
_roundService.GetLogsService().AddLog(new MiscAction("tased player " + targetRole.PlayerRole().FormatStringFullAfter(playerWhoWasDamaged.PlayerName), attacker));

return HookResult.Stop;


info.Damage = 0;

return HookResult.Continue;
}, HookMode.Pre);

}
Expand Down

0 comments on commit 7e623b1

Please sign in to comment.