Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Find all cvars details on [online docs](https://srcdslab.github.io/sm-plugin-zom
- zr_config_path_weapons - "configs/zr/weapons.txt" - Path, relative to root sourcemod directory, to weapons config file.
- zr_config_path_hitgroups - "configs/zr/hitgroups.txt" - Path, relative to root sourcemod directory, to hitgroups config file.
- zr_permissions_use_groups - "0" - Use group authentication instead of flags to access admin features. Generic admin flag is still required on some features.
- zr_permissions_flag_generic - "d" - Admin flag used for generic admin operations when group authentication is disabled. [Single flag char, e.g. d = ban | Levels: https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels]
- zr_permissions_flag_configuration - "i" - Admin flag used for configuration operations when group authentication is disabled. [Single flag char, e.g. i = config | Levels: https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels]
- zr_classes_menu_spawn - "0" - Re-display class selection menu every spawn.
- zr_classes_menu_join - "0" - Display class selection menu when a player spawn for the first time.
- zr_classes_random - "0" - Player is assigned a random class every spawn. [Override: zr_classes_default_*]
Expand Down Expand Up @@ -265,4 +267,4 @@ Find all cvars details on [online docs](https://srcdslab.github.io/sm-plugin-zom
- maxime1907
- .Rushaway
- Franug
- Anubis
- Anubis
32 changes: 29 additions & 3 deletions docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
<div class="content">
<h1>Zombie:Reloaded User Manual</h1>

<p class="headerinfo">Based on Plugin Version 3.12.11 (<a href="https://github.com/srcdslab/sm-plugin-zombiereloaded">From SRCDSLAB GitHub Repository</a>)<br />
<p class="headerinfo">Based on Plugin Version 3.13.1 (<a href="https://github.com/srcdslab/sm-plugin-zombiereloaded">From SRCDSLAB GitHub Repository</a>)<br />
Written by Richard Helgeby<br />
User Manual updated by .Rushaway (2025/06/21)</p>
User Manual updated by .Rushaway (2026/06/18)</p>

<h2>Index</h2>

Expand Down Expand Up @@ -5020,6 +5020,32 @@ <h4><a id="3.24.3">3. Console Variables</a></h4>
0 or 1</p>
</td>
</tr>

<tr>
<td class="commandheader">zr_permissions_flag_generic</td>
<td class="commandheader">d</td>
</tr>
<tr>
Comment thread
Rushaway marked this conversation as resolved.
<td class="indent" colspan="2">
<p>Admin flag used for generic admin operations when group authentication is disabled.</p>
<p>Options:<br />
Any single SourceMod admin flag character (a-z). Recommended default: d (ban).</p>
</td>
Comment thread
Copilot marked this conversation as resolved.
Outdated
</tr>

<tr>
<td class="commandheader">zr_permissions_flag_configuration</td>
<td class="commandheader">i</td>
</tr>
<tr>
<td class="indent" colspan="2">
<p>Admin flag used for configuration operations when group authentication is disabled.</p>
<p>Options:<br />
Any single SourceMod admin flag character (a-z). Recommended default: i (config).</p>
Comment thread
Copilot marked this conversation as resolved.
Outdated
<p>See SourceMod flag levels:<br />
<a href="https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels">https://wiki.alliedmods.net/Adding_Admins_(SourceMod)#Levels</a></p>
</td>
</tr>
</table></blockquote>


Expand Down Expand Up @@ -6111,4 +6137,4 @@ <h4><a id="a"></a></h4>
</div>

</body>
</html>
</html>
44 changes: 42 additions & 2 deletions src/addons/sourcemod/scripting/zr/admintools.inc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,46 @@ enum OperationTypes
OperationType_Configuration, /** Changing settings. */
}

/**
* Resolves an admin flag from the first character in a cvar.
* Falls back to defaultFlag if the cvar is empty or invalid.
*
* @param cvar Cvar with flag character.
* @param defaultFlag Fallback admin flag.
* @return Resolved admin flag.
*/
stock AdminFlag ZRResolveAdminFlag(ConVar cvar, AdminFlag defaultFlag)
{
char flagString[16];
cvar.GetString(flagString, sizeof(flagString));

Comment thread
Copilot marked this conversation as resolved.
Outdated
switch (flagString[0])
{
case 'a', 'A': return Admin_Reservation;
case 'b', 'B': return Admin_Generic;
case 'c', 'C': return Admin_Kick;
case 'd', 'D': return Admin_Ban;
case 'e', 'E': return Admin_Unban;
case 'f', 'F': return Admin_Slay;
case 'g', 'G': return Admin_Changemap;
case 'h', 'H': return Admin_Convars;
case 'i', 'I': return Admin_Config;
case 'j', 'J': return Admin_Chat;
case 'k', 'K': return Admin_Vote;
case 'l', 'L': return Admin_Password;
case 'm', 'M': return Admin_RCON;
case 'n', 'N': return Admin_Cheats;
case 'o', 'O': return Admin_Custom1;
case 'p', 'P': return Admin_Custom2;
case 'q', 'Q': return Admin_Custom3;
case 'r', 'R': return Admin_Custom4;
case 's', 'S': return Admin_Custom5;
case 't', 'T': return Admin_Custom6;
case 'z', 'Z': return Admin_Root;
}

return defaultFlag;
}

/**
* Returns whether a player is allowed to do a certain operation or not.
Expand Down Expand Up @@ -115,11 +155,11 @@ stock bool ZRIsClientPrivileged(int client, OperationTypes operationType = Opera
{
case OperationType_Generic:
{
flag = Admin_Ban;
flag = ZRResolveAdminFlag(CvarsGetPermissionFlagGeneric(), Admin_Ban);
}
case OperationType_Configuration:
{
flag = Admin_Config;
flag = ZRResolveAdminFlag(CvarsGetPermissionFlagConfiguration(), Admin_Config);
}
default:
{
Expand Down
22 changes: 21 additions & 1 deletion src/addons/sourcemod/scripting/zr/cvars.inc
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ enum struct CvarsList
ConVar CVAR_CONFIG_PATH_WEAPONS;
ConVar CVAR_CONFIG_PATH_HITGROUPS;
ConVar CVAR_PERMISSIONS_USE_GROUPS;
ConVar CVAR_PERMISSIONS_FLAG_GENERIC;
ConVar CVAR_PERMISSIONS_FLAG_CONFIGURATION;
ConVar CVAR_CLASSES_MENU_SPAWN;
ConVar CVAR_CLASSES_MENU_JOIN;
ConVar CVAR_CLASSES_RANDOM;
Expand Down Expand Up @@ -188,6 +190,22 @@ enum struct CvarsList
*/
CvarsList g_hCvarsList;

/**
* Returns the cvar handle used for generic permission flags.
*/
ConVar CvarsGetPermissionFlagGeneric()
{
return g_hCvarsList.CVAR_PERMISSIONS_FLAG_GENERIC;
}

/**
* Returns the cvar handle used for configuration permission flags.
*/
ConVar CvarsGetPermissionFlagConfiguration()
{
return g_hCvarsList.CVAR_PERMISSIONS_FLAG_CONFIGURATION;
}

/**
* @section Global cvar handles.
*/
Expand Down Expand Up @@ -255,6 +273,8 @@ void CvarsCreate()
// Permission Settings
// ===========================
g_hCvarsList.CVAR_PERMISSIONS_USE_GROUPS = CreateConVar("zr_permissions_use_groups", "0", "Use group authentication instead of flags to access admin features. Generic admin flag is still required on some features.");
g_hCvarsList.CVAR_PERMISSIONS_FLAG_GENERIC = CreateConVar("zr_permissions_flag_generic", "d", "Admin flag used for generic admin operations when group authentication is disabled. ['d' = ban]", FCVAR_NONE);
g_hCvarsList.CVAR_PERMISSIONS_FLAG_CONFIGURATION = CreateConVar("zr_permissions_flag_configuration","i", "Admin flag used for configuration operations when group authentication is disabled. ['i' = config]", FCVAR_NONE);


// ===========================
Expand Down Expand Up @@ -610,4 +630,4 @@ public void CvarsHookRestartGame(ConVar cvar, const char[] oldvalue, const char[

// If log flag check fails, then don't log.
LogEvent(false, LogType_Normal, LOG_CORE_EVENTS, LogModule_Cvars, "Restart Game", "\"mp_restartgame\" was caught and blocked, commencing round.");
}
}
4 changes: 2 additions & 2 deletions src/addons/sourcemod/scripting/zr/hgversion.h.inc
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define ZR_VER_BRANCH "master"
#define ZR_VER_MAJOR "3"
#define ZR_VER_MINOR "13"
#define ZR_VER_PATCH "0"
#define ZR_VER_PATCH "1"
#define ZR_VERSION ZR_VER_MAJOR..."."...ZR_VER_MINOR..."."...ZR_VER_PATCH
#define ZR_VER_LICENSE "GNU GPL, Version 3"
#define ZR_VER_DATE "Sat May 23 CEST 2026"
#define ZR_VER_DATE "Thu Jun 18 CEST 2026"
1 change: 1 addition & 0 deletions src/addons/sourcemod/scripting/zr/zadmin.inc
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ void ZAdminOnCommandsCreate()
{
// Register ZAdmin command.
RegConsoleCmd(SAYHOOKS_KEYWORD_ZADMIN, ZAdminCommand, "Opens ZR admin menu.");
RegConsoleCmd("sm_zadmin", ZAdminCommand, "Opens ZR admin menu.");
}

/**
Expand Down
6 changes: 6 additions & 0 deletions src/addons/sourcemod/scripting/zr/zombiereloaded.inc
Original file line number Diff line number Diff line change
Expand Up @@ -354,6 +354,12 @@ stock bool ZRIsClientAdmin(int client, AdminFlag flag = Admin_Generic)
return false;
}

// Keep default admin checks aligned with permission settings.
if (flag == Admin_Generic)
{
flag = ZRResolveAdminFlag(CvarsGetPermissionFlagGeneric(), Admin_Ban);
}
Comment thread
Rushaway marked this conversation as resolved.

// If client doesn't have the specified flag, then stop.
if (!GetAdminFlag(GetUserAdmin(client), flag))
{
Expand Down