mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-19 19:00:03 +00:00
Using type instance
This commit is contained in:
@@ -16,7 +16,6 @@ namespace CS2_SimpleAdmin;
|
|||||||
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; } = null;
|
public static CS2_SimpleAdmin Instance { get; private set; } = null;
|
||||||
public static BasePlugin? _plugin = null;
|
|
||||||
|
|
||||||
public static IStringLocalizer? _localizer;
|
public static IStringLocalizer? _localizer;
|
||||||
public static Dictionary<string, int> voteAnswers = new Dictionary<string, int>();
|
public static Dictionary<string, int> voteAnswers = new Dictionary<string, int>();
|
||||||
@@ -47,7 +46,6 @@ public partial class CS2_SimpleAdmin: BasePlugin, IPluginConfig<CS2_SimpleAdminC
|
|||||||
public override void Load(bool hotReload)
|
public override void Load(bool hotReload)
|
||||||
{
|
{
|
||||||
Instance = this;
|
Instance = this;
|
||||||
_plugin = this;
|
|
||||||
|
|
||||||
registerEvents();
|
registerEvents();
|
||||||
|
|
||||||
|
|||||||
@@ -100,24 +100,24 @@ public static class PlayerExtensions
|
|||||||
|
|
||||||
public static void Rename(this CCSPlayerController controller, string newName = "Unknown")
|
public static void Rename(this CCSPlayerController controller, string newName = "Unknown")
|
||||||
{
|
{
|
||||||
if (CS2_SimpleAdmin._plugin == null)
|
if (CS2_SimpleAdmin.Instance == null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
SchemaString<CBasePlayerController> playerName = new SchemaString<CBasePlayerController>(controller, "m_iszPlayerName");
|
SchemaString<CBasePlayerController> playerName = new SchemaString<CBasePlayerController>(controller, "m_iszPlayerName");
|
||||||
playerName.Set(newName + " ");
|
playerName.Set(newName + " ");
|
||||||
|
|
||||||
CS2_SimpleAdmin._plugin.AddTimer(0.25f, () =>
|
CS2_SimpleAdmin.Instance.AddTimer(0.25f, () =>
|
||||||
{
|
{
|
||||||
Utilities.SetStateChanged(controller, "CCSPlayerController", "m_szClan");
|
Utilities.SetStateChanged(controller, "CCSPlayerController", "m_szClan");
|
||||||
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
||||||
});
|
});
|
||||||
|
|
||||||
CS2_SimpleAdmin._plugin.AddTimer(0.3f, () =>
|
CS2_SimpleAdmin.Instance.AddTimer(0.3f, () =>
|
||||||
{
|
{
|
||||||
playerName.Set(newName);
|
playerName.Set(newName);
|
||||||
});
|
});
|
||||||
|
|
||||||
CS2_SimpleAdmin._plugin.AddTimer(0.4f, () =>
|
CS2_SimpleAdmin.Instance.AddTimer(0.4f, () =>
|
||||||
{
|
{
|
||||||
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
Utilities.SetStateChanged(controller, "CBasePlayerController", "m_iszPlayerName");
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user