Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion addons/sourcemod/scripting/AdminLogging.sp
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ ArrayList g_hSendQueue = null;
char g_sMap[PLATFORM_MAX_PATH];
char g_sWebhookURL[WEBHOOK_URL_MAX_SIZE];
bool g_bQueueSending = false;
bool g_bConfigsExecuted = false;

bool g_bLate = false;
bool g_Plugin_ExtDiscord = false;
Expand All @@ -39,7 +40,7 @@ public Plugin myinfo =
name = PLUGIN_NAME,
author = "inGame, maxime1907, .Rushaway",
description = "Admin logs saved to Discord",
version = "1.4.2",
version = "1.4.3",
url = "https://github.com/srcdslab/sm-plugin-AdminLogging"
};

Expand Down Expand Up @@ -72,6 +73,13 @@ public void OnPluginStart()
GetCurrentMap(g_sMap, sizeof(g_sMap));
}

public void OnConfigsExecuted()
{
// See https://github.com/srcdslab/sm-plugin-AdminLogging/issues/41
g_cvWebhook.GetString(g_sWebhookURL, sizeof(g_sWebhookURL));
g_bConfigsExecuted = true;
}

public void OnWebhookConVarChanged(ConVar convar, const char[] oldValue, const char[] newValue)
{
strcopy(g_sWebhookURL, sizeof(g_sWebhookURL), newValue);
Expand Down Expand Up @@ -309,6 +317,9 @@ void BuildAdminLogHeader(const char[] sTime, char[] sHeader, int maxlen)

public Action OnLogAction(Handle source, Identity ident, int client, int target, const char[] message)
{
if (!g_bConfigsExecuted)
return Plugin_Continue;

if(!g_sWebhookURL[0])
{
LogError("No webhook found or specified.");
Expand Down