sourcecomms: fixed admin immunity check
This commit is contained in:
parent
d11e4786e1
commit
4c7de59b44
@ -10,7 +10,7 @@
|
||||
{
|
||||
"DefaultTime" "-1" // default time in minutes. if < 0 -> blocking for session. Permanent (0) - is not allowed!
|
||||
"DisableUnblockImmunityCheck" "0" // 0, 1. If 1, player can be ungagged only by issuer admin, console or admin with special flag
|
||||
// Also, If 0 player maybe unblocked by Admin with higher immunity level then issuer admin.
|
||||
// Also, If 0 player maybe unblocked by Admin with same or higher immunity level than issuer admin.
|
||||
// Default value is 0
|
||||
"ConsoleImmunity" "100" // Immunity Level of server console. If not specified - 0.
|
||||
"MaxLength" "0" // Max allowed punishment length (in minutes) for admins without ADMFLAG_CUSTOM2 (p).
|
||||
|
@ -262,7 +262,7 @@ public OnMapEnd()
|
||||
AND length = -1",
|
||||
DatabasePrefix, serverID);
|
||||
#if defined LOG_QUERIES
|
||||
LogToFile(logQuery, "OnMapEnd for: %s. QUERY: %s", clientAuth, Query);
|
||||
LogToFile(logQuery, "OnMapEnd. QUERY: %s", Query);
|
||||
#endif
|
||||
SQL_TQuery(g_hDatabase, Query_ErrorCheck, Query);
|
||||
|
||||
@ -1360,6 +1360,12 @@ public Query_UnBlockSelect(Handle:owner, Handle:hndl, const String:error[], any:
|
||||
new cImmunity = SQL_FetchInt(hndl, 3);
|
||||
new cType = SQL_FetchInt(hndl, 4);
|
||||
|
||||
new immunity = admin ? GetAdmImmunity(admin) : ConsoleImmunity;
|
||||
|
||||
// Block from CONSOLE (aid=0) and we have `console immunity` value in config
|
||||
if (!cAID && ConsoleImmunity > cImmunity)
|
||||
cImmunity = ConsoleImmunity;
|
||||
|
||||
#if defined DEBUG
|
||||
PrintToServer("Fetched from DB: bid %d, iAID: %d, cAID: %d, cImmunity: %d, cType: %d", bid, iAID, cAID, cImmunity, cType);
|
||||
// WHO WE ARE?
|
||||
@ -1370,12 +1376,12 @@ public Query_UnBlockSelect(Handle:owner, Handle:hndl, const String:error[], any:
|
||||
PrintToServer("we are console (possibly)");
|
||||
if (AdmHasFlag(admin))
|
||||
PrintToServer("we have special flag");
|
||||
if (GetAdmImmunity(admin) > cImmunity)
|
||||
PrintToServer("we have %d immunity and block has %d. we cool", GetAdmImmunity(admin), cImmunity);
|
||||
if (immunity >= cImmunity)
|
||||
PrintToServer("we have %d immunity and block has %d. we cool", immunity, cImmunity);
|
||||
#endif
|
||||
|
||||
// Checking - has we access to unblock?
|
||||
if (iAID == cAID || (!admin && StrEqual(adminAuth, "STEAM_ID_SERVER")) || AdmHasFlag(admin) || (DisUBImCheck == 0 && (GetAdmImmunity(admin) > cImmunity)))
|
||||
if (iAID == cAID || (!admin && StrEqual(adminAuth, "STEAM_ID_SERVER")) || AdmHasFlag(admin) || (DisUBImCheck == 0 && (immunity >= cImmunity)))
|
||||
{
|
||||
// Ok! we have rights to unblock
|
||||
b_success = true;
|
||||
@ -2102,7 +2108,7 @@ stock CreateBlock(client, targetId = 0, length = -1, type, const String:sReason[
|
||||
return;
|
||||
}
|
||||
|
||||
new admImmunity = GetAdmImmunity(client);
|
||||
new admImmunity = client ? GetAdmImmunity(client) : ConsoleImmunity;
|
||||
decl String:adminAuth[64];
|
||||
|
||||
if (client && IsClientInGame(client))
|
||||
|
Loading…
Reference in New Issue
Block a user