diff --git a/cstrike/addons/sourcemod/translations/no/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/no/zombiereloaded.phrases.txt index fa1dc3c..b5c4dc5 100644 --- a/cstrike/addons/sourcemod/translations/no/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/no/zombiereloaded.phrases.txt @@ -24,7 +24,6 @@ { "no" "{1}" } - // Set string to "{1}" for all languages. "Feature is disabled" { @@ -46,6 +45,11 @@ "no" "Denne funksjonen gjelder kun for administratorer." } + "No access to command" + { + "no" "Du har ikke tilgang til denne kommandoen." + } + "Must be alive" { "no" "Denne funksjonen gjelder kun for levende spillere." diff --git a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt index cdc43f8..0679d3b 100644 --- a/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt +++ b/cstrike/addons/sourcemod/translations/zombiereloaded.phrases.txt @@ -59,6 +59,11 @@ "en" "This feature is reserved for admins only." } + "No access to command" + { + "en" "You do not have access to this command." + } + "Must be alive" { "en" "This feature requires that you are alive." diff --git a/src/zr/admintools.inc b/src/zr/admintools.inc index 725f7c4..f3c6dd5 100644 --- a/src/zr/admintools.inc +++ b/src/zr/admintools.inc @@ -26,7 +26,7 @@ */ /** - * @section Pre-defined group names for authenticating players. + * @section Pre-defined SourceMod group names for authenticating players. */ #define ZR_GROUP_ADMINS "zr_admins" #define ZR_GROUP_MODERATORS "zr_moderators" @@ -68,7 +68,7 @@ stock bool:ZRIsClientPrivileged(client, OperationTypes:operationType = Operation return false; } - // Check if group permissions is enabled. + // Check if group authentication is used. new bool:groupauth = GetConVarBool(g_hCvarsList[CVAR_PERMISSIONS_USE_GROUPS]); if (groupauth) { diff --git a/src/zr/antistick.inc b/src/zr/antistick.inc index b19bc1c..8e8de79 100644 --- a/src/zr/antistick.inc +++ b/src/zr/antistick.inc @@ -99,7 +99,7 @@ AntiStickOnCommandsCreate() RegConsoleCmd("zr_antistick_list_models", AntiStickListModelsCommand, "Lists all players and their model data in console. Usage: zr_antistick_list_models"); // Create admin command to set model hull width. - RegAdminCmd("zr_antistick_set_width", AntiStickSetWidthCommand, ADMFLAG_GENERIC, "Sets the width of a model's hull. (See zr_antistick_list_models) Usage: zr_antistick_set_width "); + RegConsoleCmd("zr_antistick_set_width", AntiStickSetWidthCommand, "Sets the width of a model's hull. (See zr_antistick_list_models) Usage: zr_antistick_set_width "); RegConsoleCmd("zr_antistick_dump_group", AntiStickDumpGroupCommand, "Dumps collision group data on one or more players. Usage zr_antistick_dump_group [#userid|name]"); } @@ -733,6 +733,13 @@ public Action:AntiStickListModelsCommand(client, argc) */ public Action:AntiStickSetWidthCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If not enough arguments given, then stop. if (argc < 2) { diff --git a/src/zr/config.inc b/src/zr/config.inc index bad6c29..40aa171 100644 --- a/src/zr/config.inc +++ b/src/zr/config.inc @@ -187,8 +187,8 @@ enum ConfigKvAction ConfigOnCommandsCreate() { // Create config admin commands. - RegAdminCmd("zr_config_reload", ConfigReloadCommand, ADMFLAG_CONFIG, "Reloads a config file. Usage: zr_config_reload "); - RegAdminCmd("zr_config_reloadall", ConfigReloadAllCommand, ADMFLAG_CONFIG, "Reloads all config files. Usage: zr_config_reloadall"); + RegConsoleCmd("zr_config_reload", ConfigReloadCommand, "Reloads a config file. Usage: zr_config_reload "); + RegConsoleCmd("zr_config_reloadall", ConfigReloadAllCommand, "Reloads all config files. Usage: zr_config_reloadall"); } /** @@ -786,6 +786,13 @@ stock ConfigFile:ConfigAliasToConfigFile(const String:alias[]) */ public Action:ConfigReloadCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If not enough arguments given, then stop. if (argc < 1) { @@ -847,6 +854,13 @@ public Action:ConfigReloadCommand(client, argc) */ public Action:ConfigReloadAllCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // Begin statistics. TranslationReplyToCommand(client, "Config command reload all stats begin"); diff --git a/src/zr/debugtools.inc b/src/zr/debugtools.inc index e8082ae..e2e1876 100644 --- a/src/zr/debugtools.inc +++ b/src/zr/debugtools.inc @@ -28,10 +28,13 @@ DebugOnCommandsCreate() { // Custom test commands: + /* RegConsoleCmd("zr_getparametercount", Command_GetParameterCount, "Test GetParameterCount function in paramtools.inc. Usage: zr_getparametercount "); RegConsoleCmd("zr_getparametervalue", Command_GetParameterValue, "Test GetParameterValue function in paramtools.inc. Usage: zr_getparametervalue "); + */ } +/* public Action:Command_GetParameterCount(client, argc) { if (argc < 1) @@ -102,4 +105,5 @@ public Action:Command_GetParameterValue(client, argc) ReplyToCommand(client, "Return value: %d\nParameter string: \"%s\"\nParameter value: \"%s\"", retval, paramstring, valuebuffer); return Plugin_Handled; -} \ No newline at end of file +} +*/ diff --git a/src/zr/hitgroups.inc b/src/zr/hitgroups.inc index 33d6194..f37b250 100644 --- a/src/zr/hitgroups.inc +++ b/src/zr/hitgroups.inc @@ -68,9 +68,9 @@ new Handle:arrayHitgroups = INVALID_HANDLE; HitgroupsOnCommandsCreate() { // Create config admin commands. - RegAdminCmd("zr_hitgroup", HitgroupsCommand, ADMFLAG_CONFIG, "Toggles or sets if a zombie's hitgroup can be damaged. Usage: zr_hitgroup [1/0]"); - RegAdminCmd("zr_hitgroup_enable_all", HitgroupsEnableAllCommand, ADMFLAG_CONFIG, "Enables all zombie hitgroups to be damaged. Usage: zr_hitgroup_enable_all"); - RegAdminCmd("zr_hitgroup_headshots_only", HitgroupsHeadshotsOnlyCommand, ADMFLAG_CONFIG, "Disables all zombie hitgroups but the head. Usage: zr_hitgroup_headshots_only"); + RegConsoleCmd("zr_hitgroup", HitgroupsCommand, "Toggles or sets if a zombie's hitgroup can be damaged. Usage: zr_hitgroup [1/0]"); + RegConsoleCmd("zr_hitgroup_enable_all", HitgroupsEnableAllCommand, "Enables all zombie hitgroups to be damaged. Usage: zr_hitgroup_enable_all"); + RegConsoleCmd("zr_hitgroup_headshots_only", HitgroupsHeadshotsOnlyCommand, "Disables all zombie hitgroups but the head. Usage: zr_hitgroup_headshots_only"); } /** @@ -507,6 +507,13 @@ public HitgroupsMenuHitgroupsHandle(Handle:menu_hitgroups, MenuAction:action, cl */ public Action:HitgroupsCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If module is disabled, then stop. new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]); if (!hitgroups) @@ -593,6 +600,13 @@ public Action:HitgroupsCommand(client, argc) */ public Action:HitgroupsEnableAllCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If module is disabled, then stop. new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]); if (!hitgroups) @@ -627,6 +641,13 @@ public Action:HitgroupsEnableAllCommand(client, argc) */ public Action:HitgroupsHeadshotsOnlyCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If module is disabled, then stop. new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]); if (!hitgroups) diff --git a/src/zr/infect.inc b/src/zr/infect.inc index 10b56d5..5668146 100644 --- a/src/zr/infect.inc +++ b/src/zr/infect.inc @@ -105,8 +105,8 @@ InfectLoad() */ InfectOnCommandsCreate() { - RegAdminCmd("zr_infect", InfectInfectCommand, ADMFLAG_GENERIC, "Infect a client. Usage: zr_infect [respawn - 1/0]"); - RegAdminCmd("zr_human", InfectHumanCommand, ADMFLAG_GENERIC, "Turn a client into a human. Usage: zr_human [respawn - 1/0]"); + RegConsoleCmd("zr_infect", InfectInfectCommand, "Infect a client. Usage: zr_infect [respawn - 1/0]"); + RegConsoleCmd("zr_human", InfectHumanCommand, "Turn a client into a human. Usage: zr_human [respawn - 1/0]"); } /** @@ -1073,6 +1073,13 @@ stock InfectManualHuman(client, targets[], count, bool:respawn = false, bool:pro */ public Action:InfectInfectCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If not enough arguments given, then stop. if (argc < 1) { @@ -1124,6 +1131,13 @@ public Action:InfectInfectCommand(client, argc) */ public Action:InfectHumanCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If not enough arguments given, then stop. if (argc < 1) { diff --git a/src/zr/log.inc b/src/zr/log.inc index 99e9e5c..3e37a6b 100644 --- a/src/zr/log.inc +++ b/src/zr/log.inc @@ -470,8 +470,8 @@ LogModuleFilterCacheUpdate() LogOnCommandsCreate() { RegConsoleCmd("zr_log_list", Command_LogList, "List available logging flags and modules with their status values."); - RegAdminCmd("zr_log_add_module", Command_LogAddModule, ADMFLAG_CONFIG, "Add one or more modules to the module filter. Usage: zr_log_add_module [module] ..."); - RegAdminCmd("zr_log_remove_module", Command_LogRemoveModule, ADMFLAG_CONFIG, "Remove one or more modules from the module filter. Usage: zr_log_remove_module [module] ..."); + RegConsoleCmd("zr_log_add_module", Command_LogAddModule, "Add one or more modules to the module filter. Usage: zr_log_add_module [module] ..."); + RegConsoleCmd("zr_log_remove_module", Command_LogRemoveModule, "Remove one or more modules from the module filter. Usage: zr_log_remove_module [module] ..."); } /** @@ -567,6 +567,13 @@ public Action:Command_LogAddModule(client, argc) decl String:argument[32]; buffer[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + new LogModules:logmodule; // Check if no arguments. @@ -618,6 +625,13 @@ public Action:Command_LogRemoveModule(client, argc) decl String:argument[32]; buffer[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + new LogModules:logmodule; // Check if no arguments. diff --git a/src/zr/playerclasses/classcommands.inc b/src/zr/playerclasses/classcommands.inc index b0258e7..0a5b540 100644 --- a/src/zr/playerclasses/classcommands.inc +++ b/src/zr/playerclasses/classcommands.inc @@ -31,11 +31,11 @@ ClassOnCommandsCreate() RegConsoleCmd(SAYHOOKS_KEYWORD_ZCLASS, ZClassCommand, "Opens class selection menu."); // Create base class commands. - RegAdminCmd("zr_class_dump", ClassDumpCommand, ADMFLAG_GENERIC, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump "); - RegAdminCmd("zr_class_dump_multipliers", ClassDumpMultipliersCommand, ADMFLAG_GENERIC, "Dumps class attribute multipliers for the specified team. Usage: zr_class_dump_multipliers <\"zombies\"|\"humans\">"); - RegAdminCmd("zr_class_modify", ClassModifyCommand, ADMFLAG_CONFIG, "Modify class data on one or more classes. Usage: zr_class_modify [is_multiplier]"); - RegAdminCmd("zr_class_set_multiplier", ClassSetMultiplierCommand, ADMFLAG_CONFIG, "Sets the multiplier on a class attribute. Usage: zr_class_set_multiplier <\"zombies\"|\"humans\"> "); - RegAdminCmd("zr_class_reload", ClassReloadCommand, ADMFLAG_GENERIC, "Refreshes the player cache and reloads class attributes on one or more players. Usage: zr_class_reload "); + RegConsoleCmd("zr_class_dump", ClassDumpCommand, "Dumps class data at a specified index in the specified cache. Usage: zr_class_dump "); + RegConsoleCmd("zr_class_dump_multipliers", ClassDumpMultipliersCommand, "Dumps class attribute multipliers for the specified team. Usage: zr_class_dump_multipliers <\"zombies\"|\"humans\">"); + RegConsoleCmd("zr_class_modify", ClassModifyCommand, "Modify class data on one or more classes. Usage: zr_class_modify [is_multiplier]"); + RegConsoleCmd("zr_class_set_multiplier", ClassSetMultiplierCommand, "Sets the multiplier on a class attribute. Usage: zr_class_set_multiplier <\"zombies\"|\"humans\"> "); + RegConsoleCmd("zr_class_reload", ClassReloadCommand, "Refreshes the player cache and reloads class attributes on one or more players. Usage: zr_class_reload "); } /** @@ -89,6 +89,13 @@ public Action:ClassDumpCommand(client, argc) decl String:syntax[320]; syntax[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 2) { // Write syntax info. @@ -194,6 +201,13 @@ public Action:ClassDumpMultipliersCommand(client, argc) decl String:arg[16]; buffer[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 1) { // Write syntax info. @@ -269,6 +283,13 @@ public Action:ClassModifyCommand(client, argc) decl String:syntax[1024]; syntax[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 3) { // Write syntax info. @@ -488,6 +509,13 @@ public Action:ClassSetMultiplierCommand(client, argc) decl String:syntax[320]; syntax[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 3) { // Write syntax info. @@ -561,6 +589,13 @@ public Action:ClassReloadCommand(client, argc) new targetcount; new bool:tn_is_ml; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 1) { // Write syntax info. diff --git a/src/zr/versioninfo.inc b/src/zr/versioninfo.inc index b83972e..33ab594 100644 --- a/src/zr/versioninfo.inc +++ b/src/zr/versioninfo.inc @@ -36,25 +36,27 @@ public Action:Command_Version(client, argc) buffer[0] = 0; linebuffer[0] = 0; + #define FORMATSTRING "%24s: %s\n" + Format(linebuffer, sizeof(linebuffer), "%s\n", ZR_VER_PRODUCT_NAME); StrCat(buffer, sizeof(buffer), linebuffer); Format(linebuffer, sizeof(linebuffer), "%s\n\n", ZR_VER_COPYRIGHT); StrCat(buffer, sizeof(buffer), linebuffer); - Format(linebuffer, sizeof(linebuffer), "Version: %s\n", ZR_VER_VERSION); + Format(linebuffer, sizeof(linebuffer), FORMATSTRING, "Version", ZR_VER_VERSION); StrCat(buffer, sizeof(buffer), linebuffer); - Format(linebuffer, sizeof(linebuffer), "Development branch: %s\n", ZR_VER_BRANCH); + Format(linebuffer, sizeof(linebuffer), FORMATSTRING, "Compile date", ZR_VER_DATE); StrCat(buffer, sizeof(buffer), linebuffer); - Format(linebuffer, sizeof(linebuffer), "Revision: %s\n", ZR_VER_REVISION); + Format(linebuffer, sizeof(linebuffer), FORMATSTRING, "License", ZR_VER_LICENSE); StrCat(buffer, sizeof(buffer), linebuffer); - Format(linebuffer, sizeof(linebuffer), "License: %s\n", ZR_VER_LICENSE); + Format(linebuffer, sizeof(linebuffer), FORMATSTRING, "Build", ZR_VER_REVISION); StrCat(buffer, sizeof(buffer), linebuffer); - Format(linebuffer, sizeof(linebuffer), "Compile date: %s", ZR_VER_DATE); + Format(linebuffer, sizeof(linebuffer), FORMATSTRING, "Development branch", ZR_VER_BRANCH); StrCat(buffer, sizeof(buffer), linebuffer); ReplyToCommand(client, buffer); diff --git a/src/zr/volfeatures/volcommands.inc b/src/zr/volfeatures/volcommands.inc index 26d3098..360eede 100644 --- a/src/zr/volfeatures/volcommands.inc +++ b/src/zr/volfeatures/volcommands.inc @@ -55,8 +55,8 @@ Example: */ VolOnCommandsCreate() { - RegAdminCmd("zr_vol_add", VolAddVolumeCommand, ADMFLAG_CONFIG, "Creates a rectangular volume in the map. Usage: zr_vol_add [params]"); - RegAdminCmd("zr_vol_remove", VolRemoveVolumeCommand, ADMFLAG_CONFIG, "Removes an existing volume in the map. Usage: zr_vol_remove "); + RegConsoleCmd("zr_vol_add", VolAddVolumeCommand, "Creates a rectangular volume in the map. Usage: zr_vol_add [params]"); + RegConsoleCmd("zr_vol_remove", VolRemoveVolumeCommand, "Removes an existing volume in the map. Usage: zr_vol_remove "); RegConsoleCmd("zr_vol_list", VolListCommand, "Lists existing volumes in the map, or dumps detail data to the specified volume. Usage: zr_vol_list [volume index]"); RegConsoleCmd("zr_vol_dumpstates", VolDumpStatesCommand, "Dumps volume states for the specified player. Usage: zr_vol_dumpstates "); } @@ -69,6 +69,13 @@ public Action:VolAddVolumeCommand(client, argc) decl String:buffer[640]; buffer[0] = 0; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 7) { // Write syntax info. @@ -255,6 +262,13 @@ public Action:VolRemoveVolumeCommand(client, argc) decl String:arg[16]; new volindex; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 1) { // Write syntax info. @@ -440,6 +454,13 @@ public Action:VolDumpStatesCommand(client, argc) decl String:target[64]; new targetclient; + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + if (argc < 1) { ReplyToCommand(client, "Dumps volume states for the specified player. Usage: zr_vol_dumpstates "); diff --git a/src/zr/weapons/restrict.inc b/src/zr/weapons/restrict.inc index bf63c33..4502f5a 100644 --- a/src/zr/weapons/restrict.inc +++ b/src/zr/weapons/restrict.inc @@ -126,8 +126,8 @@ RestrictLoad() RestrictOnCommandsCreate() { // Create weapon admin commands. - RegAdminCmd("zr_restrict", RestrictCommand, ADMFLAG_CONFIG, "Restricts a weapon or a weapon type. Usage: zr_restrict [weapon2|weapontype2] ..."); - RegAdminCmd("zr_unrestrict", UnrestrictCommand, ADMFLAG_CONFIG, "Unrestricts a weapon or a weapon type. Usage: zr_unrestrict [weapon2|weapontype2] ..."); + RegConsoleCmd("zr_restrict", RestrictCommand, "Restricts a weapon or a weapon type. Usage: zr_restrict [weapon2|weapontype2] ..."); + RegConsoleCmd("zr_unrestrict", UnrestrictCommand, "Unrestricts a weapon or a weapon type. Usage: zr_unrestrict [weapon2|weapontype2] ..."); } /** @@ -657,6 +657,13 @@ public ZRTools_Action:RestrictCanUse(client, weapon) */ public Action:RestrictCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If weapons module is disabled, then stop. new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]); if (!weapons) @@ -711,6 +718,13 @@ public Action:RestrictCommand(client, argc) */ public Action:UnrestrictCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Configuration)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If weapons module is disabled, then stop. new bool:weapons = GetConVarBool(g_hCvarsList[CVAR_WEAPONS]); if (!weapons) diff --git a/src/zr/zadmin.inc b/src/zr/zadmin.inc index 557f7ae..b0a91d4 100644 --- a/src/zr/zadmin.inc +++ b/src/zr/zadmin.inc @@ -71,6 +71,9 @@ bool:ZAdminMenu(client) return false; } + // Boolean that tell if client is allowed to do configuration. + new bool:configallowed = ZRIsClientPrivileged(client, OperationType_Configuration); + // Create menu handle. new Handle:menu_zadmin = CreateMenu(ZAdminMenuHandle); @@ -94,15 +97,15 @@ bool:ZAdminMenu(client) Format(ztele, sizeof(ztele), "%t", "ZAdmin main force ztele"); // Get conditions for options. - new configdraw = MenuGetItemDraw(ZRIsClientPrivileged(client, OperationType_Configuration)); + new configdraw = MenuGetItemDraw(configallowed); new moderatordraw = MenuGetItemDraw(ZRIsClientPrivileged(client, OperationType_Generic)); - new bool:hitgroupsenabled = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]) && ZRIsClientPrivileged(client, OperationType_Configuration); + new hitgroupdraw = MenuGetItemDraw(GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]) && configallowed); // Add items to menu. SetMenuTitle(menu_zadmin, title); AddMenuItem(menu_zadmin, "classmultipliers", classmultipliers, configdraw); AddMenuItem(menu_zadmin, "weapons", weapons, configdraw); - AddMenuItem(menu_zadmin, "hitgroups", hitgroups, MenuGetItemDraw(hitgroupsenabled)); + AddMenuItem(menu_zadmin, "hitgroups", hitgroups, hitgroupdraw); AddMenuItem(menu_zadmin, "infect", infect, moderatordraw); AddMenuItem(menu_zadmin, "zspawn", zspawn, moderatordraw); AddMenuItem(menu_zadmin, "ztele", ztele, moderatordraw); diff --git a/src/zr/zspawn.inc b/src/zr/zspawn.inc index eaf2baf..ac1a0e7 100644 --- a/src/zr/zspawn.inc +++ b/src/zr/zspawn.inc @@ -44,7 +44,7 @@ ZSpawnOnCommandsCreate() RegConsoleCmd(SAYHOOKS_KEYWORD_ZSPAWN, ZSpawnCommand, "Spawn into the game after joining late."); // Register admin command to force ZSpawn. - RegAdminCmd("zr_zspawn_force", ZSpawnForceCommand, ADMFLAG_GENERIC, "Force ZSpawn on a client. Usage: zr_zspawn_force ['0' = Spawn as human | '1' = Spawn as zombie]"); + RegConsoleCmd("zr_zspawn_force", ZSpawnForceCommand, "Force ZSpawn on a client. Usage: zr_zspawn_force ['0' = Spawn as human | '1' = Spawn as zombie]"); } /** @@ -331,6 +331,13 @@ public ZSpawnForceHandle(Handle:menu_zspawn_force, MenuAction:action, client, sl */ public Action:ZSpawnCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If client is console, then stop and tell them this feature is for players only. if (ZRIsConsole(client)) { diff --git a/src/zr/ztele.inc b/src/zr/ztele.inc index ca5d90e..f794201 100644 --- a/src/zr/ztele.inc +++ b/src/zr/ztele.inc @@ -59,7 +59,7 @@ ZTeleOnCommandsCreate() RegConsoleCmd(SAYHOOKS_KEYWORD_ZTELE, ZTeleCommand, "Teleport back to spawn if you are stuck."); // Register admin command to force ZTele. - RegAdminCmd("zr_ztele_force", ZTeleForceCommand, ADMFLAG_GENERIC, "Force ZTele on a client. Usage: zr_ztele_force "); + RegConsoleCmd("zr_ztele_force", ZTeleForceCommand, "Force ZTele on a client. Usage: zr_ztele_force "); } /** @@ -299,6 +299,13 @@ public ZTeleForceHandle(Handle:menu_ztele_force, MenuAction:action, client, slot */ public Action:ZTeleForceCommand(client, argc) { + // Check if privileged. + if (!ZRIsClientPrivileged(client, OperationType_Generic)) + { + TranslationReplyToCommand(client, "No access to command"); + return Plugin_Handled; + } + // If not enough arguments given, then stop. if (argc < 1) { @@ -340,11 +347,11 @@ public Action:ZTeleForceCommand(client, argc) TranslationReplyToCommand(client, "ZTele command force unsuccessful", targetname); } } + + // Log action to game events. + LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_ZTele, "Force ZTele", "\"%L\" teleported \"%L\" to spawn.", client, targets[x]); } - // Log action to game events. - LogEvent(false, LogType_Normal, LOG_GAME_EVENTS, LogModule_ZTele, "Force ZTele", "Admin \"%L\" forced player(s) to teleport to spawn. (zr_ztele_force)", client); - return Plugin_Handled; }