Skip to content

Commit

Permalink
1.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
oqyh authored Dec 17, 2023
1 parent f90ad99 commit 25478e0
Show file tree
Hide file tree
Showing 3 changed files with 187 additions and 0 deletions.
25 changes: 25 additions & 0 deletions CS2_Game_Manager.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.5.002.0
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Game_Manager", "Game_Manager.csproj", "{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BBF71B01-1FE4-4F6A-B088-6A65C7024A31}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {196C969D-3792-4309-ABCE-7A7E8F403A48}
EndGlobalSection
EndGlobal
139 changes: 139 additions & 0 deletions Game_Manager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Core.Attributes;
using System.Text.Json.Serialization;

namespace Game_Manager;


public class GameBMangerConfig : BasePluginConfig
{
[JsonPropertyName("DisableRadio")] public bool DisableRadio { get; set; } = false;
[JsonPropertyName("DisablePing")] public bool DisablePing { get; set; } = false;
[JsonPropertyName("DisableChatWheel")] public bool DisableChatWheel { get; set; } = false;
[JsonPropertyName("DisableKillfeed")] public bool DisableKillfeed { get; set; } = false;
[JsonPropertyName("DisableWinOrLosePanel")] public bool DisableWinOrLosePanel { get; set; } = false;
[JsonPropertyName("DisableWinOrLoseSound")] public bool DisableWinOrLoseSound { get; set; } = false;
[JsonPropertyName("IgnoreJoinTeamMessages")] public bool IgnoreJoinTeamMessages { get; set; } = false;
[JsonPropertyName("IgnoreDefaultDisconnectMessages")] public bool IgnoreDefaultDisconnectMessages { get; set; } = false;
}

public class GameBManger : BasePlugin, IPluginConfig<GameBMangerConfig>
{
public override string ModuleName => "Game Manager";
public override string ModuleVersion => "1.0.0";
public override string ModuleAuthor => "Gold KingZ";
public override string ModuleDescription => "Block/Hide , Messages , Ping , Radio , Connect , Disconnect , Sounds";

public GameBMangerConfig Config { get; set; }

public void OnConfigParsed(GameBMangerConfig config)
{
Config = config;
}
private string[] RadioArray = new string[] {
"coverme",
"takepoint",
"holdpos",
"regroup",
"followme",
"takingfire",
"go",
"fallback",
"sticktog",
"getinpos",
"stormfront",
"report",
"roger",
"enemyspot",
"needbackup",
"sectorclear",
"inposition",
"reportingin",
"getout",
"negative",
"enemydown",
"sorry",
"cheer",
"compliment",
"thanks",
"go_a",
"go_b",
"needrop",
"deathcry"
};

public override void Load(bool hotReload)
{

//AddCommandListener("chatwheel_ping", CommandListener_chatwheelping);
//AddCommandListener("playerradio", CommandListener_playerradio);
AddCommandListener("player_ping", CommandListener_Ping);
AddCommandListener("playerchatwheel", CommandListener_chatwheel);
//RegisterEventHandler<EventPlayerDisconnect>(OnPlayerDisconnect, HookMode.Pre);
//RegisterEventHandler<EventPlayerTeam>(OnPlayerTeam, HookMode.Pre);
RegisterEventHandler<EventRoundEnd>((@event, info) =>
{
if (!Config.DisableWinOrLoseSound || @event == null)return HookResult.Continue;

info.DontBroadcast = true;

return HookResult.Continue;
}, HookMode.Pre);
RegisterEventHandler<EventCsWinPanelRound>((@event, info) =>
{
if (!Config.DisableWinOrLosePanel || @event == null)return HookResult.Continue;

info.DontBroadcast = true;

return HookResult.Continue;
}, HookMode.Pre);
RegisterEventHandler<EventPlayerDisconnect>((@event, info) =>
{
if (!Config.IgnoreDefaultDisconnectMessages || @event == null)return HookResult.Continue;

info.DontBroadcast = true;

return HookResult.Continue;
}, HookMode.Pre);
RegisterEventHandler<EventPlayerTeam>((@event, info) =>
{
if (!Config.IgnoreJoinTeamMessages || @event == null)return HookResult.Continue;

info.DontBroadcast = true;

return HookResult.Continue;
}, HookMode.Pre);
RegisterEventHandler<EventPlayerDeath>((@event, info) =>
{
if (!Config.DisableKillfeed || @event == null)return HookResult.Continue;

info.DontBroadcast = true;

return HookResult.Continue;
}, HookMode.Pre);
for (int i = 0; i < RadioArray.Length; i++)
{
AddCommandListener(RadioArray[i], CommandListener_RadioCommands);
}
}
private HookResult CommandListener_Ping(CCSPlayerController? player, CommandInfo info)
{
if(!Config.DisablePing || player == null || !player.IsValid)return HookResult.Continue;

return HookResult.Handled;
}

private HookResult CommandListener_chatwheel(CCSPlayerController? player, CommandInfo info)
{
if(!Config.DisableChatWheel || player == null || !player.IsValid)return HookResult.Continue;

return HookResult.Handled;
}
private HookResult CommandListener_RadioCommands(CCSPlayerController? player, CommandInfo info)
{
if(!Config.DisableRadio || player == null || !player.IsValid)return HookResult.Continue;

return HookResult.Handled;
}
}
23 changes: 23 additions & 0 deletions Game_Manager.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net7.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>

<ItemGroup>

<Reference Include="CounterStrikeSharp.API">

<HintPath>CounterStrikeSharp.API.dll</HintPath>

</Reference>

</ItemGroup>

<ItemGroup>
<PackageReference Include="Nexd.MySQL" Version="1.0.1" />
</ItemGroup>

</Project>

0 comments on commit 25478e0

Please sign in to comment.