mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-17 18:39:07 +00:00
Merge pull request #62 from Dliix66/feature/menu
Fixed maps not being displayed in the menus
This commit is contained in:
@@ -39,12 +39,14 @@ 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 & Dliix66";
|
||||
public override string ModuleVersion => "1.3.2a";
|
||||
public override string ModuleVersion => "1.3.2b";
|
||||
|
||||
public CS2_SimpleAdminConfig Config { get; set; } = new();
|
||||
|
||||
public override void Load(bool hotReload)
|
||||
{
|
||||
Instance = this;
|
||||
|
||||
registerEvents();
|
||||
|
||||
if (hotReload)
|
||||
@@ -107,7 +109,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
Config = config;
|
||||
_localizer = Localizer;
|
||||
|
||||
|
||||
@@ -43,7 +43,6 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
{
|
||||
|
||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||
{
|
||||
Helper.PrintToCenterAll(_localizer!["sa_admin_vote_message", caller == null ? "Console" : caller.PlayerName, question]);
|
||||
|
||||
@@ -53,7 +53,6 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
using (new WithTemporaryCulture(_player.GetLanguage()))
|
||||
{
|
||||
|
||||
StringBuilder sb = new(_localizer!["sa_prefix"]);
|
||||
sb.Append(_localizer["sa_admin_slay_message", callerName, player.PlayerName]);
|
||||
_player.PrintToChat(sb.ToString());
|
||||
@@ -118,11 +117,13 @@ namespace CS2_SimpleAdmin
|
||||
player.GiveNamedItem(weapon);
|
||||
SubGiveWeapon(caller, player, weapon.ToString(), callerName);
|
||||
}
|
||||
|
||||
public void GiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||
{
|
||||
player.GiveNamedItem(weaponName);
|
||||
SubGiveWeapon(caller, player, weaponName, callerName);
|
||||
}
|
||||
|
||||
public void SubGiveWeapon(CCSPlayerController? caller, CCSPlayerController player, string weaponName, string? callerName = null)
|
||||
{
|
||||
callerName ??= caller == null ? "Console" : caller.PlayerName;
|
||||
@@ -338,7 +339,6 @@ namespace CS2_SimpleAdmin
|
||||
godPlayers = new ConcurrentBag<int>(godPlayers.Where(item => item != player.Slot));
|
||||
}
|
||||
|
||||
|
||||
if (caller == null || caller != null && !silentPlayers.Contains(caller.Slot))
|
||||
{
|
||||
foreach (CCSPlayerController _player in Helper.GetValidPlayers())
|
||||
@@ -603,7 +603,6 @@ namespace CS2_SimpleAdmin
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
[ConsoleCommand("css_tp", "Teleport to a player.")]
|
||||
|
||||
@@ -7,6 +7,7 @@ namespace CS2_SimpleAdmin
|
||||
{
|
||||
[JsonPropertyName("DiscordLogWebhook")]
|
||||
public string DiscordLogWebhook { get; set; } = "";
|
||||
|
||||
[JsonPropertyName("DiscordPenaltyWebhook")]
|
||||
public string DiscordPenaltyWebhook { get; set; } = "";
|
||||
}
|
||||
|
||||
@@ -166,7 +166,6 @@ public partial class CS2_SimpleAdmin
|
||||
{
|
||||
player.VoiceFlags = VoiceFlags.Muted;
|
||||
});
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -283,7 +282,6 @@ public partial class CS2_SimpleAdmin
|
||||
});
|
||||
|
||||
playerPenaltyManager.RemoveExpiredPenalties();
|
||||
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.REPEAT | CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
string? path = Path.GetDirectoryName(ModuleDirectory);
|
||||
@@ -337,7 +335,6 @@ public partial class CS2_SimpleAdmin
|
||||
});
|
||||
}, CounterStrikeSharp.API.Modules.Timers.TimerFlags.STOP_ON_MAPCHANGE);
|
||||
|
||||
|
||||
AddTimer(2.0f, () =>
|
||||
{
|
||||
ConVar? botQuota = ConVar.Find("bot_quota");
|
||||
@@ -369,5 +366,4 @@ public partial class CS2_SimpleAdmin
|
||||
|
||||
return HookResult.Continue;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -140,7 +140,6 @@ public static class PlayerExtensions
|
||||
target.PlayerPawn.Value.AbsRotation,
|
||||
target.PlayerPawn.Value.AbsVelocity
|
||||
);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,6 @@ namespace CS2_SimpleAdmin
|
||||
|
||||
if (flags != null)
|
||||
{
|
||||
|
||||
foreach (var flag in flags)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(flag))
|
||||
|
||||
@@ -8,9 +8,11 @@ namespace CS2_SimpleAdmin
|
||||
public class AdminSQLManager
|
||||
{
|
||||
private readonly Database _database;
|
||||
|
||||
// Unused for now
|
||||
//public static readonly ConcurrentDictionary<string, ConcurrentBag<string>> _adminCache = new ConcurrentDictionary<string, ConcurrentBag<string>>();
|
||||
public static readonly ConcurrentDictionary<SteamID, DateTime?> _adminCache = new ConcurrentDictionary<SteamID, DateTime?>();
|
||||
|
||||
//public static readonly ConcurrentDictionary<SteamID, DateTime?> _adminCacheTimestamps = new ConcurrentDictionary<SteamID, DateTime?>();
|
||||
|
||||
public AdminSQLManager(Database database)
|
||||
@@ -100,7 +102,6 @@ namespace CS2_SimpleAdmin
|
||||
filteredFlagsWithImmunity.Add((flagsValue.Split(',').ToList(), immunityValue));
|
||||
}
|
||||
|
||||
|
||||
/* Unused for now
|
||||
bool shouldCache = activeFlags.Any(flags =>
|
||||
{
|
||||
@@ -306,7 +307,6 @@ namespace CS2_SimpleAdmin
|
||||
if (CS2_SimpleAdmin._logger != null)
|
||||
CS2_SimpleAdmin._logger.LogCritical("Unable to remove expired admins");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,6 +8,7 @@ namespace CS2_SimpleAdmin.Menus
|
||||
public static class FunActionsMenu
|
||||
{
|
||||
private static Dictionary<int, CsItem>? _weaponsCache = null;
|
||||
|
||||
private static Dictionary<int, CsItem> GetWeaponsCache
|
||||
{
|
||||
get
|
||||
@@ -29,6 +30,7 @@ namespace CS2_SimpleAdmin.Menus
|
||||
return _weaponsCache;
|
||||
}
|
||||
}
|
||||
|
||||
public static void OpenMenu(CCSPlayerController admin)
|
||||
{
|
||||
if (admin == null || admin.IsValid == false)
|
||||
@@ -76,7 +78,6 @@ namespace CS2_SimpleAdmin.Menus
|
||||
AdminMenu.OpenMenu(admin, menu);
|
||||
}
|
||||
|
||||
|
||||
private static void GodMode(CCSPlayerController admin, CCSPlayerController player)
|
||||
{
|
||||
CS2_SimpleAdmin.Instance.God(admin, player);
|
||||
|
||||
Reference in New Issue
Block a user