-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathOpenDoorsNoCT.cs
More file actions
45 lines (38 loc) · 1.27 KB
/
OpenDoorsNoCT.cs
File metadata and controls
45 lines (38 loc) · 1.27 KB
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
42
43
44
45
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Core.Attributes.Registration;
using CounterStrikeSharp.API.Modules.Utils;
public class Plugin : BasePlugin
{
public override string ModuleName => "OpenDoorsNoCT";
public override string ModuleVersion => "";
public override string ModuleAuthor => "exkludera";
static void ForceEntInput(String name, String input)
{
var target = Utilities.FindAllEntitiesByDesignerName<CBaseEntity>(name);
foreach (var ent in target)
{
if (!ent.IsValid)
continue;
ent.AcceptInput(input);
}
}
private bool IsCTEmpty()
{
int CTCount = Utilities.GetPlayers().Where(p => p.Team.Equals(CsTeam.CounterTerrorist)).Count();
if (CTCount >= 1)
return false;
return true;
}
[GameEventHandler]
public HookResult RoundStart(EventRoundStart @event, GameEventInfo info)
{
if (IsCTEmpty() == true) {
ForceEntInput("func_door", "Open");
ForceEntInput("func_movelinear", "Open");
ForceEntInput("func_door_rotating", "Open");
ForceEntInput("prop_door_rotating", "Open");
}
return HookResult.Continue;
}
}