Skip to content
Open
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
20 changes: 16 additions & 4 deletions addons/sourcemod/scripting/VIP_SourcemodFlags.sp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ bool g_bSbppClientsLoaded = false;
bool g_bReloadVips = false;
bool g_bLibraryCCC = false;
bool g_bLateLoaded = false;
bool g_bInSBPPCallback = false;

// Track original immunity levels and VIP immunity status
int g_iOriginalImmunity[MAXPLAYERS + 1] = { 0, ... };
Expand All @@ -30,7 +31,7 @@ public Plugin myinfo =
name = "[VIP] Sourcemod Flags",
author = "R1KO & inGame & maxime1907",
description = "Sets the sourcemod flags related to VIP features",
version = "3.2.4"
version = "3.2.5"
};

public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max)
Expand Down Expand Up @@ -174,11 +175,20 @@ public bool SBPP_OnClientPreAdminCheck(AdminCachePart part)
g_bSbppClientsLoaded = true;

if (g_bReloadVips)
{
// Apply VIP flags before CheckLoadAdmins calls NotifyPostAdminCheck.
// Use g_bInSBPPCallback to suppress per-client notifications here
// since CheckLoadAdmins will notify all clients after the forward returns.
g_bInSBPPCallback = true;
ReloadVIPs();
g_bInSBPPCallback = false;
}

g_bReloadVips = false;
}
return false;
// Return true so CheckLoadAdmins proceeds with NotifyPostAdminCheck for all clients,
// including those registered to this forward from other plugins.
return true;
}
#endif

Expand Down Expand Up @@ -309,7 +319,9 @@ stock void TryNotifyPostAdminCheck(int client)
RunAdminCacheChecks(client);

#if defined _sourcebanspp_included
if (g_bSbppClientsLoaded && g_bClientLoaded[client])
// Skip individual notification when inside SBPP callback: CheckLoadAdmins
// will call NotifyPostAdminCheck for all clients after the forward returns.
if (!g_bInSBPPCallback && g_bSbppClientsLoaded && g_bClientLoaded[client])
{
NotifyPostAdminCheck(client);
}
Expand All @@ -326,4 +338,4 @@ stock void ReloadVIPs()
LoadVIPClient(i);
}
}
}
}