mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 10:28:26 +00:00
fix flag access & admin reloads in for shavit-chat
This commit is contained in:
parent
bfa9aa45e4
commit
41f50505f9
@ -106,6 +106,8 @@ bool gB_CCAccess[MAXPLAYERS+1];
|
|||||||
char gS_CustomName[MAXPLAYERS+1][128];
|
char gS_CustomName[MAXPLAYERS+1][128];
|
||||||
char gS_CustomMessage[MAXPLAYERS+1][16];
|
char gS_CustomMessage[MAXPLAYERS+1][16];
|
||||||
|
|
||||||
|
bool gB_AdminChecked[MAXPLAYERS+1];
|
||||||
|
|
||||||
chatstrings_t gS_ChatStrings;
|
chatstrings_t gS_ChatStrings;
|
||||||
|
|
||||||
// chat procesor
|
// chat procesor
|
||||||
@ -190,6 +192,7 @@ public void OnPluginStart()
|
|||||||
|
|
||||||
if (IsClientAuthorized(i))
|
if (IsClientAuthorized(i))
|
||||||
{
|
{
|
||||||
|
OnClientAuthorized(i, "");
|
||||||
OnClientPostAdminCheck(i);
|
OnClientPostAdminCheck(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -623,12 +626,17 @@ public void OnClientCookiesCached(int client)
|
|||||||
|
|
||||||
if(strlen(sChatSettings) == 0)
|
if(strlen(sChatSettings) == 0)
|
||||||
{
|
{
|
||||||
SetClientCookie(client, gH_ChatCookie, "-2");
|
|
||||||
gI_ChatSelection[client] = -2;
|
gI_ChatSelection[client] = -2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
gI_ChatSelection[client] = StringToInt(sChatSettings);
|
gI_ChatSelection[client] = StringToInt(sChatSettings);
|
||||||
|
|
||||||
|
if (gB_AdminChecked[client] && !HasRankAccess(client, gI_ChatSelection[client]))
|
||||||
|
{
|
||||||
|
SetClientCookie(client, gH_ChatCookie, "-2");
|
||||||
|
gI_ChatSelection[client] = -2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -645,9 +653,11 @@ public void OnClientDisconnect(int client)
|
|||||||
{
|
{
|
||||||
SaveToDatabase(client);
|
SaveToDatabase(client);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gB_AdminChecked[client] = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnClientPostAdminCheck(int client)
|
public void OnClientAuthorized(int client, const char[] auth)
|
||||||
{
|
{
|
||||||
if (gH_SQL)
|
if (gH_SQL)
|
||||||
{
|
{
|
||||||
@ -655,6 +665,34 @@ public void OnClientPostAdminCheck(int client)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnClientPostAdminCheck(int client)
|
||||||
|
{
|
||||||
|
gB_AdminChecked[client] = true;
|
||||||
|
|
||||||
|
if (AreClientCookiesCached(client))
|
||||||
|
{
|
||||||
|
if (!HasRankAccess(client, gI_ChatSelection[client]))
|
||||||
|
{
|
||||||
|
SetClientCookie(client, gH_ChatCookie, "-2");
|
||||||
|
gI_ChatSelection[client] = -2;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnRebuildAdminCache(AdminCachePart part)
|
||||||
|
{
|
||||||
|
if (part == AdminCache_Overrides) // the last of the 3 parts when I tested
|
||||||
|
{
|
||||||
|
for (int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if (IsValidClient(i) && !IsFakeClient(i) && IsClientAuthorized(i))
|
||||||
|
{
|
||||||
|
OnClientPostAdminCheck(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public Action Command_CCHelp(int client, int args)
|
public Action Command_CCHelp(int client, int args)
|
||||||
{
|
{
|
||||||
if(client == 0)
|
if(client == 0)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user