forked from itsAudioo/SpawnProtection
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathExtensions.cs
More file actions
22 lines (18 loc) · 818 Bytes
/
Extensions.cs
File metadata and controls
22 lines (18 loc) · 818 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
namespace SpawnProtection
{
using CounterStrikeSharp.API.Core;
using static SpawnProtection.SpawnProt;
public static class Extensions
{
public static bool IsProtected(this CCSPlayerController player)
=> Instance.protectedPlayers.Contains(player)
|| Instance._playerStates.TryGetValue(player.Index, out var playerState)
&& playerState.ProtectionState == ProtectionState.Protected;
public static bool IzGud(this CCSPlayerController? player)
=> player?.IsValid == true && player.PlayerPawn?.IsValid == true;
public static bool IsBot(this CCSPlayerController? player)
=> player?.IsBot == true || player?.IsHLTV == true;
public static bool IsAlive(this CCSPlayerController player)
=> player.Pawn.Value?.LifeState == (byte)LifeState_t.LIFE_ALIVE && player.PlayerPawn.Value?.Health > 0;
}
}