Skip to content

Commit 25478e0

Browse files
authored
1.0.0
1 parent f90ad99 commit 25478e0

3 files changed

Lines changed: 187 additions & 0 deletions

File tree

CS2_Game_Manager.sln

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.5.002.0
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game_Manager", "Game_Manager.csproj", "{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}"
7+
EndProject
8+
Global
9+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
10+
Debug|Any CPU = Debug|Any CPU
11+
Release|Any CPU = Release|Any CPU
12+
EndGlobalSection
13+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
14+
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
15+
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Debug|Any CPU.Build.0 = Debug|Any CPU
16+
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Release|Any CPU.ActiveCfg = Release|Any CPU
17+
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Release|Any CPU.Build.0 = Release|Any CPU
18+
EndGlobalSection
19+
GlobalSection(SolutionProperties) = preSolution
20+
HideSolutionNode = FALSE
21+
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {196C969D-3792-4309-ABCE-7A7E8F403A48}
24+
EndGlobalSection
25+
EndGlobal

Game_Manager.cs

Lines changed: 139 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,139 @@
1+
using CounterStrikeSharp.API.Core;
2+
using CounterStrikeSharp.API.Modules.Commands;
3+
using CounterStrikeSharp.API.Core.Attributes;
4+
using System.Text.Json.Serialization;
5+
6+
namespace Game_Manager;
7+
8+
9+
public class GameBMangerConfig : BasePluginConfig
10+
{
11+
[JsonPropertyName("DisableRadio")] public bool DisableRadio { get; set; } = false;
12+
[JsonPropertyName("DisablePing")] public bool DisablePing { get; set; } = false;
13+
[JsonPropertyName("DisableChatWheel")] public bool DisableChatWheel { get; set; } = false;
14+
[JsonPropertyName("DisableKillfeed")] public bool DisableKillfeed { get; set; } = false;
15+
[JsonPropertyName("DisableWinOrLosePanel")] public bool DisableWinOrLosePanel { get; set; } = false;
16+
[JsonPropertyName("DisableWinOrLoseSound")] public bool DisableWinOrLoseSound { get; set; } = false;
17+
[JsonPropertyName("IgnoreJoinTeamMessages")] public bool IgnoreJoinTeamMessages { get; set; } = false;
18+
[JsonPropertyName("IgnoreDefaultDisconnectMessages")] public bool IgnoreDefaultDisconnectMessages { get; set; } = false;
19+
}
20+
21+
public class GameBManger : BasePlugin, IPluginConfig<GameBMangerConfig>
22+
{
23+
public override string ModuleName => "Game Manager";
24+
public override string ModuleVersion => "1.0.0";
25+
public override string ModuleAuthor => "Gold KingZ";
26+
public override string ModuleDescription => "Block/Hide , Messages , Ping , Radio , Connect , Disconnect , Sounds";
27+
28+
public GameBMangerConfig Config { get; set; }
29+
30+
public void OnConfigParsed(GameBMangerConfig config)
31+
{
32+
Config = config;
33+
}
34+
private string[] RadioArray = new string[] {
35+
"coverme",
36+
"takepoint",
37+
"holdpos",
38+
"regroup",
39+
"followme",
40+
"takingfire",
41+
"go",
42+
"fallback",
43+
"sticktog",
44+
"getinpos",
45+
"stormfront",
46+
"report",
47+
"roger",
48+
"enemyspot",
49+
"needbackup",
50+
"sectorclear",
51+
"inposition",
52+
"reportingin",
53+
"getout",
54+
"negative",
55+
"enemydown",
56+
"sorry",
57+
"cheer",
58+
"compliment",
59+
"thanks",
60+
"go_a",
61+
"go_b",
62+
"needrop",
63+
"deathcry"
64+
};
65+
66+
public override void Load(bool hotReload)
67+
{
68+
69+
//AddCommandListener("chatwheel_ping", CommandListener_chatwheelping);
70+
//AddCommandListener("playerradio", CommandListener_playerradio);
71+
AddCommandListener("player_ping", CommandListener_Ping);
72+
AddCommandListener("playerchatwheel", CommandListener_chatwheel);
73+
//RegisterEventHandler<EventPlayerDisconnect>(OnPlayerDisconnect, HookMode.Pre);
74+
//RegisterEventHandler<EventPlayerTeam>(OnPlayerTeam, HookMode.Pre);
75+
RegisterEventHandler<EventRoundEnd>((@event, info) =>
76+
{
77+
if (!Config.DisableWinOrLoseSound || @event == null)return HookResult.Continue;
78+
79+
info.DontBroadcast = true;
80+
81+
return HookResult.Continue;
82+
}, HookMode.Pre);
83+
RegisterEventHandler<EventCsWinPanelRound>((@event, info) =>
84+
{
85+
if (!Config.DisableWinOrLosePanel || @event == null)return HookResult.Continue;
86+
87+
info.DontBroadcast = true;
88+
89+
return HookResult.Continue;
90+
}, HookMode.Pre);
91+
RegisterEventHandler<EventPlayerDisconnect>((@event, info) =>
92+
{
93+
if (!Config.IgnoreDefaultDisconnectMessages || @event == null)return HookResult.Continue;
94+
95+
info.DontBroadcast = true;
96+
97+
return HookResult.Continue;
98+
}, HookMode.Pre);
99+
RegisterEventHandler<EventPlayerTeam>((@event, info) =>
100+
{
101+
if (!Config.IgnoreJoinTeamMessages || @event == null)return HookResult.Continue;
102+
103+
info.DontBroadcast = true;
104+
105+
return HookResult.Continue;
106+
}, HookMode.Pre);
107+
RegisterEventHandler<EventPlayerDeath>((@event, info) =>
108+
{
109+
if (!Config.DisableKillfeed || @event == null)return HookResult.Continue;
110+
111+
info.DontBroadcast = true;
112+
113+
return HookResult.Continue;
114+
}, HookMode.Pre);
115+
for (int i = 0; i < RadioArray.Length; i++)
116+
{
117+
AddCommandListener(RadioArray[i], CommandListener_RadioCommands);
118+
}
119+
}
120+
private HookResult CommandListener_Ping(CCSPlayerController? player, CommandInfo info)
121+
{
122+
if(!Config.DisablePing || player == null || !player.IsValid)return HookResult.Continue;
123+
124+
return HookResult.Handled;
125+
}
126+
127+
private HookResult CommandListener_chatwheel(CCSPlayerController? player, CommandInfo info)
128+
{
129+
if(!Config.DisableChatWheel || player == null || !player.IsValid)return HookResult.Continue;
130+
131+
return HookResult.Handled;
132+
}
133+
private HookResult CommandListener_RadioCommands(CCSPlayerController? player, CommandInfo info)
134+
{
135+
if(!Config.DisableRadio || player == null || !player.IsValid)return HookResult.Continue;
136+
137+
return HookResult.Handled;
138+
}
139+
}

Game_Manager.csproj

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net7.0</TargetFramework>
5+
<ImplicitUsings>enable</ImplicitUsings>
6+
<Nullable>enable</Nullable>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
11+
<Reference Include="CounterStrikeSharp.API">
12+
13+
<HintPath>CounterStrikeSharp.API.dll</HintPath>
14+
15+
</Reference>
16+
17+
</ItemGroup>
18+
19+
<ItemGroup>
20+
<PackageReference Include="Nexd.MySQL" Version="1.0.1" />
21+
</ItemGroup>
22+
23+
</Project>

0 commit comments

Comments
 (0)