Skip to content

Commit

Permalink
1.3.0e
Browse files Browse the repository at this point in the history
- Added `css_sa_upgrade` command
  • Loading branch information
daffyyyy committed Feb 11, 2024
1 parent 79bbe0f commit 0b2a520
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 3 deletions.
30 changes: 29 additions & 1 deletion CS2-SimpleAdmin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin";
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy";
public override string ModuleVersion => "1.3.0d";
public override string ModuleVersion => "1.3.0e";

public CS2_SimpleAdminConfig Config { get; set; } = new();

Expand Down Expand Up @@ -121,6 +121,34 @@ public void OnConfigParsed(CS2_SimpleAdminConfig config)
_localizer = Localizer;
}

[ConsoleCommand("css_sa_upgrade")]
[CommandHelper(whoCanExecute: CommandUsage.SERVER_ONLY)]
public void OnSaUpgradeCommand(CCSPlayerController? caller, CommandInfo command)
{
if (caller != null || _database == null) return;

Task.Run(async () =>
{
try
{
using (var connection = await _database.GetConnectionAsync())
{
var commandText = "ALTER TABLE `sa_mutes` CHANGE `type` `type` ENUM('GAG','MUTE', 'SILENCE', '') CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT 'GAG';";

using (var command = connection.CreateCommand())
{
command.CommandText = commandText;
await command.ExecuteNonQueryAsync();
}
}
}
catch (Exception ex)
{
Logger.LogError($"{ex.Message}");
}
});
}

[ConsoleCommand("css_admin")]
[RequiresPermissions("@css/generic")]
public void OnAdminCommand(CCSPlayerController? caller, CommandInfo command)
Expand Down
6 changes: 5 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Manage your Counter-Strike 2 server by simple commands :)
- css_mute <#userid or name> [time in minutes/0 perm] [reason] - Mute player // @css/chat
- css_addmute <steamid> [time in minutes/0 perm] [reason] - Mute player via steamid64 // @css/chat
- css_unmute <steamid or name> - Unmute player // @css/chat
- css_silence <#userid or name> [time in minutes/0 perm] [reason] - Silence player // @css/chat
- css_addsilence <steamid> [time in minutes/0 perm] [reason] - Silence player via steamid64 // @css/chat
- css_unsilence <steamid or name> - Unsilence player // @css/chat
- css_give <#userid or name> <weapon> - Give weapon to player // @css/cheats
- css_strip <#userid or name> - Takes all of the player weapons // @css/slay
- css_hp <#userid or name> [health] - Set player health // @css/slay
Expand All @@ -49,6 +52,7 @@ Manage your Counter-Strike 2 server by simple commands :)
- css_noclip <#userid or name> - Toggle noclip for player // @css/cheats
- css_freeze <#userid or name> [duration] - Freeze player // @css/slay
- css_unfreeze <#userid or name> - Unfreeze player // @css/slay
- css_rename <#userid or name> <new name> - Rename player // @css/kick
- css_respawn <#userid or name> - Respawn player // @css/cheats
- css_cvar <cvar> <value> - Change cvar value // @css/cvar
- css_rcon <command> - Run command as server // @css/rcon
Expand All @@ -58,7 +62,7 @@ Manage your Counter-Strike 2 server by simple commands :)
```

### Requirments
- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on v159**
- [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp/) **tested on v163**
- MySQL **tested on MySQL (MariaDB) Server version: 10.11.4-MariaDB-1~deb12u1 Debian 12**


Expand Down
2 changes: 1 addition & 1 deletion database_setup.sql
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ CREATE TABLE IF NOT EXISTS `sa_mutes` (
`duration` int(11) NOT NULL,
`ends` timestamp NOT NULL,
`created` timestamp NOT NULL,
`type` enum('GAG','MUTE','') NOT NULL DEFAULT 'GAG',
`type` enum('GAG','MUTE','SILENCE','') NOT NULL DEFAULT 'GAG',
`server_id` INT NULL,
`status` enum('ACTIVE','UNMUTED','EXPIRED','') NOT NULL DEFAULT 'ACTIVE',
PRIMARY KEY (`id`)
Expand Down

0 comments on commit 0b2a520

Please sign in to comment.