-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathKilFeedFilter.cs
41 lines (35 loc) · 1.45 KB
/
KilFeedFilter.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Events;
namespace KillFeedFilter
{
[MinimumApiVersion(60)]
public class KilFeedFilter : BasePlugin
{
public override string ModuleName => "AbNeR Killfeed Filter";
public override string ModuleVersion => "1.0.1";
public override string ModuleAuthor => "AbNeR_CSS";
public override string ModuleDescription => "Shows only your kills/deaths/assists in the killfeed";
public override void Load(bool hotReload)
{
Console.WriteLine("AbNeR Killfeed filter loaded");
}
void FireIfValidPlayer(GameEvent @event, CCSPlayerController? player)
{
if (player is not null && player.IsValid && !player.IsBot)
@event.FireEventToClient(player);
}
[GameEventHandler(HookMode.Pre)]
public HookResult OnPlayerDeath(EventPlayerDeath @event, GameEventInfo info)
{
if ([email protected] || @event.Attacker.UserId == @event.Userid.UserId)
return HookResult.Continue;
FireIfValidPlayer(@event, @event.Attacker);
FireIfValidPlayer(@event, @event.Assister);
FireIfValidPlayer(@event, @event.Userid);
info.DontBroadcast = true;
return HookResult.Continue;
}
}
}