- Removed message of checking server ip
- Fixed some commands
- Changed workshopmaps config
- Probably fixed votes (untested)  - let me know if not
- Minimum css version - 246
This commit is contained in:
Dawid Bepierszcz
2024-06-29 11:33:41 +02:00
parent cdd771511b
commit a395a7d9c8
9 changed files with 13 additions and 23 deletions

View File

@@ -11,7 +11,7 @@ using System.Collections.Concurrent;
namespace CS2_SimpleAdmin;
[MinimumApiVersion(228)]
[MinimumApiVersion(246)]
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
{
public static CS2_SimpleAdmin Instance { get; private set; } = new();
@@ -39,7 +39,7 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
public override string ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
public override string ModuleAuthor => "daffyy & Dliix66";
public override string ModuleVersion => "1.4.7a";
public override string ModuleVersion => "1.4.8a";
public CS2_SimpleAdminConfig Config { get; set; } = new();

View File

@@ -10,9 +10,9 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.244" />
<PackageReference Include="CounterStrikeSharp.API" Version="1.0.246" />
<PackageReference Include="Dapper" Version="2.1.35" />
<PackageReference Include="Discord.Net.Webhook" Version="3.15.1" />
<PackageReference Include="Discord.Net.Webhook" Version="3.15.2" />
<PackageReference Include="MySqlConnector" Version="2.3.7" />
<PackageReference Include="Newtonsoft.Json" Version="*" />
</ItemGroup>

View File

@@ -522,7 +522,7 @@ namespace CS2_SimpleAdmin
playersToTarget.ForEach(player =>
{
if (!player.IsBot && player.SteamID.ToString().Length != 17)
if (player == null || !player.IsValid)
return;
if (caller!.CanTarget(player))

View File

@@ -54,7 +54,7 @@ namespace CS2_SimpleAdmin
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
player.PrintToChat(sb.ToString());
voteMenu.OpenToAll();
voteMenu.Open(player);
//MenuManager.OpenChatMenu(player, voteMenu);
}

View File

@@ -69,9 +69,6 @@ namespace CS2_SimpleAdmin
playersToTarget.ForEach(player =>
{
if (!player.IsBot && player.Connected == PlayerConnectedState.PlayerConnected)
return;
if (caller!.CanTarget(player))
{
Freeze(caller, player, time, callerName);
@@ -115,9 +112,6 @@ namespace CS2_SimpleAdmin
playersToTarget.ForEach(player =>
{
if (!player.IsBot && player.Connected == PlayerConnectedState.PlayerConnected)
return;
Unfreeze(caller, player, callerName, command);
});
}

View File

@@ -207,7 +207,7 @@ namespace CS2_SimpleAdmin
public void SetHp(CCSPlayerController? caller, CCSPlayerController? player, int health, CommandInfo? command = null)
{
if (player != null && !player.IsBot && player.Connected == PlayerConnectedState.PlayerConnected)
if (player == null || !player.IsValid || player.IsHLTV)
return;
var callerName = caller == null ? "Console" : caller.PlayerName;

View File

@@ -170,7 +170,7 @@ namespace CS2_SimpleAdmin
public List<string> DefaultMaps { get; set; } = new();
[JsonPropertyName("WorkshopMaps")]
public List<string> WorkshopMaps { get; set; } = new();
public Dictionary<string, long?> WorkshopMaps { get; set; } = new();
[JsonPropertyName("CustomServerCommands")]
public List<CustomServerCommandData> CustomServerCommands { get; set; } = new();

View File

@@ -31,8 +31,6 @@ public partial class CS2_SimpleAdmin
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
{
ipAddress = Helper.GetServerIp();
Logger.LogError("Unable to get server ip, Check that you have added the correct start parameter \"-ip <ip>\"");
Logger.LogError($"Using alternative method... Server IP {ipAddress}");
}
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
@@ -365,8 +363,6 @@ public partial class CS2_SimpleAdmin
{
return;
ipAddress = Helper.GetServerIp();
Logger.LogError("Unable to get server ip, Check that you have added the correct start parameter \"-ip <ip>\"");
Logger.LogError($"Using alternative method... Server IP {ipAddress}");
}
var address = $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";

View File

@@ -53,7 +53,7 @@ namespace CS2_SimpleAdmin.Menus
options.AddRange(maps.Select(map => new ChatMenuOptionData(map, () => ExecuteChangeMap(admin, map, false))));
var wsMaps = CS2_SimpleAdmin.Instance.Config.WorkshopMaps;
options.AddRange(wsMaps.Select(map => new ChatMenuOptionData($"{map} (WS)", () => ExecuteChangeMap(admin, map, true))));
options.AddRange(wsMaps.Select(map => new ChatMenuOptionData($"{map.Key} (WS)", () => ExecuteChangeMap(admin, map.Value?.ToString() ?? map.Key, true))));
foreach (var menuOptionData in options)
{