mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-17 18:39:07 +00:00
1.4.8a
- 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:
@@ -11,7 +11,7 @@ using System.Collections.Concurrent;
|
|||||||
|
|
||||||
namespace CS2_SimpleAdmin;
|
namespace CS2_SimpleAdmin;
|
||||||
|
|
||||||
[MinimumApiVersion(228)]
|
[MinimumApiVersion(246)]
|
||||||
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
|
public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdminConfig>
|
||||||
{
|
{
|
||||||
public static CS2_SimpleAdmin Instance { get; private set; } = new();
|
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 ModuleName => "CS2-SimpleAdmin" + (Helper.IsDebugBuild ? " (DEBUG)" : " (RELEASE)");
|
||||||
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
public override string ModuleDescription => "Simple admin plugin for Counter-Strike 2 :)";
|
||||||
public override string ModuleAuthor => "daffyy & Dliix66";
|
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();
|
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
||||||
|
|
||||||
|
|||||||
@@ -10,9 +10,9 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<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="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="MySqlConnector" Version="2.3.7" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="*" />
|
<PackageReference Include="Newtonsoft.Json" Version="*" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|||||||
@@ -522,7 +522,7 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.SteamID.ToString().Length != 17)
|
if (player == null || !player.IsValid)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ namespace CS2_SimpleAdmin
|
|||||||
StringBuilder sb = new(_localizer["sa_prefix"]);
|
StringBuilder sb = new(_localizer["sa_prefix"]);
|
||||||
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
sb.Append(_localizer["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||||
player.PrintToChat(sb.ToString());
|
player.PrintToChat(sb.ToString());
|
||||||
|
|
||||||
voteMenu.OpenToAll();
|
voteMenu.Open(player);
|
||||||
|
|
||||||
//MenuManager.OpenChatMenu(player, voteMenu);
|
//MenuManager.OpenChatMenu(player, voteMenu);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,6 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.Connected == PlayerConnectedState.PlayerConnected)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (caller!.CanTarget(player))
|
if (caller!.CanTarget(player))
|
||||||
{
|
{
|
||||||
Freeze(caller, player, time, callerName);
|
Freeze(caller, player, time, callerName);
|
||||||
@@ -115,9 +112,6 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
playersToTarget.ForEach(player =>
|
playersToTarget.ForEach(player =>
|
||||||
{
|
{
|
||||||
if (!player.IsBot && player.Connected == PlayerConnectedState.PlayerConnected)
|
|
||||||
return;
|
|
||||||
|
|
||||||
Unfreeze(caller, player, callerName, command);
|
Unfreeze(caller, player, callerName, command);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -207,7 +207,7 @@ namespace CS2_SimpleAdmin
|
|||||||
|
|
||||||
public void SetHp(CCSPlayerController? caller, CCSPlayerController? player, int health, CommandInfo? command = null)
|
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;
|
return;
|
||||||
|
|
||||||
var callerName = caller == null ? "Console" : caller.PlayerName;
|
var callerName = caller == null ? "Console" : caller.PlayerName;
|
||||||
|
|||||||
@@ -170,7 +170,7 @@ namespace CS2_SimpleAdmin
|
|||||||
public List<string> DefaultMaps { get; set; } = new();
|
public List<string> DefaultMaps { get; set; } = new();
|
||||||
|
|
||||||
[JsonPropertyName("WorkshopMaps")]
|
[JsonPropertyName("WorkshopMaps")]
|
||||||
public List<string> WorkshopMaps { get; set; } = new();
|
public Dictionary<string, long?> WorkshopMaps { get; set; } = new();
|
||||||
|
|
||||||
[JsonPropertyName("CustomServerCommands")]
|
[JsonPropertyName("CustomServerCommands")]
|
||||||
public List<CustomServerCommandData> CustomServerCommands { get; set; } = new();
|
public List<CustomServerCommandData> CustomServerCommands { get; set; } = new();
|
||||||
|
|||||||
@@ -31,8 +31,6 @@ public partial class CS2_SimpleAdmin
|
|||||||
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
|
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
|
||||||
{
|
{
|
||||||
ipAddress = Helper.GetServerIp();
|
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"))
|
if (string.IsNullOrEmpty(ipAddress) || ipAddress.StartsWith("0.0.0"))
|
||||||
@@ -188,7 +186,7 @@ public partial class CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
// Add player's IP and SteamID to bannedPlayers list if not already present
|
// Add player's IP and SteamID to bannedPlayers list if not already present
|
||||||
if (Config.BanType > 0 && playerInfo.IpAddress != null &&
|
if (Config.BanType > 0 && playerInfo.IpAddress != null &&
|
||||||
!BannedPlayers.Contains(playerInfo.IpAddress))
|
!BannedPlayers.Contains(playerInfo.IpAddress))
|
||||||
{
|
{
|
||||||
BannedPlayers.Add(playerInfo.IpAddress);
|
BannedPlayers.Add(playerInfo.IpAddress);
|
||||||
}
|
}
|
||||||
@@ -202,7 +200,7 @@ public partial class CS2_SimpleAdmin
|
|||||||
await Server.NextFrameAsync(() =>
|
await Server.NextFrameAsync(() =>
|
||||||
{
|
{
|
||||||
var victim = Utilities.GetPlayerFromUserid(playerInfo.UserId);
|
var victim = Utilities.GetPlayerFromUserid(playerInfo.UserId);
|
||||||
|
|
||||||
if (victim?.UserId != null)
|
if (victim?.UserId != null)
|
||||||
{
|
{
|
||||||
if (UnlockedCommands)
|
if (UnlockedCommands)
|
||||||
@@ -365,8 +363,6 @@ public partial class CS2_SimpleAdmin
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
ipAddress = Helper.GetServerIp();
|
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>()}";
|
var address = $"{ipAddress}:{ConVar.Find("hostport")?.GetPrimitiveValue<int>()}";
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ namespace CS2_SimpleAdmin.Menus
|
|||||||
options.AddRange(maps.Select(map => new ChatMenuOptionData(map, () => ExecuteChangeMap(admin, map, false))));
|
options.AddRange(maps.Select(map => new ChatMenuOptionData(map, () => ExecuteChangeMap(admin, map, false))));
|
||||||
|
|
||||||
var wsMaps = CS2_SimpleAdmin.Instance.Config.WorkshopMaps;
|
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)
|
foreach (var menuOptionData in options)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user