First commit

This commit is contained in:
2026-07-07 16:36:30 +02:00
commit b0669c4f4d
9 changed files with 545 additions and 0 deletions

60
commands/admin.cs Normal file
View File

@@ -0,0 +1,60 @@
using CounterStrikeSharp.API;
using CounterStrikeSharp.API.Core;
using CounterStrikeSharp.API.Modules.Admin;
using CounterStrikeSharp.API.Modules.Commands;
using CounterStrikeSharp.API.Modules.Cvars;
namespace Porning;
class AdminCommands
{
private readonly BasePlugin plugin;
public AdminCommands(BasePlugin pluginInstance)
{
plugin = pluginInstance;
}
private ConVar autoBhopCvar = ConVar.Find("sv_autobunnyhopping")!;
[CommandHelper(minArgs: 1, usage: "[map_name]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@porning/admin")]
public void onMap(CCSPlayerController? player, CommandInfo commandInfo)
{
string map = commandInfo.GetArg(1);
if (!Server.IsMapValid(map))
{
Info info = new Info(plugin, "Map not recognised.");
info.Show(player);
return;
}
Server.ExecuteCommand($"map {map}");
}
[CommandHelper(minArgs: 0, usage: "[0/1]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@porning/admin")]
public void onBhop(CCSPlayerController? player, CommandInfo commandInfo)
{
Info info;
if (commandInfo.ArgCount == 1)
{
bool autoBhop = autoBhopCvar.GetPrimitiveValue<bool>();
Server.ExecuteCommand($"sv_autobunnyhopping {!autoBhop}");
info = new Info(plugin, $"Toggled bhop: {!autoBhop}");
info.Show(player);
return;
}
string bhop = commandInfo.GetArg(1);
Server.ExecuteCommand($"sv_autobunnyhopping {bhop}");
info = new Info(plugin, $"Toggled bhop: {bhop}");
info.Show(player);
}
[CommandHelper(minArgs: 1, usage: "[message]", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
[RequiresPermissions("@porning/admin")]
public void onInfo(CCSPlayerController? player, CommandInfo commandInfo)
{
string message = commandInfo.GetCommandString.Substring(9);
Info info = new Info(plugin, message);
info.Show();
}
}