Disable hitgroups in the menu if cvar is disabled, stop hitgroup commands from working if hitgroups are disabled.

This commit is contained in:
Greyscale 2009-07-02 01:44:41 -07:00
parent 3f5c477e08
commit 8bf948b540
2 changed files with 29 additions and 1 deletions

View File

@ -506,6 +506,14 @@ public HitgroupsMenuHitgroupsHandle(Handle:menu_hitgroups, MenuAction:action, cl
*/
public Action:HitgroupsCommand(client, argc)
{
// If module is disabled, then stop.
new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
if (!hitgroups)
{
TranslationReplyToCommand(client, "Feature is disabled");
return;
}
// If not enough arguments given, then stop.
if (argc < 1)
{
@ -584,6 +592,14 @@ public Action:HitgroupsCommand(client, argc)
*/
public Action:HitgroupsEnableAllCommand(client, argc)
{
// If module is disabled, then stop.
new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
if (!hitgroups)
{
TranslationReplyToCommand(client, "Feature is disabled");
return;
}
// x = Hitgroup index.
new size = GetArraySize(arrayHitgroups);
for (new x = 0; x < size; x++)
@ -610,6 +626,14 @@ public Action:HitgroupsEnableAllCommand(client, argc)
*/
public Action:HitgroupsHeadshotsOnlyCommand(client, argc)
{
// If module is disabled, then stop.
new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
if (!hitgroups)
{
TranslationReplyToCommand(client, "Feature is disabled");
return;
}
// x = Hitgroup index.
new size = GetArraySize(arrayHitgroups);
for (new x = 0; x < size; x++)

View File

@ -95,9 +95,13 @@ bool:ZAdminMenu(client)
Format(ztele, sizeof(ztele), "%t", "ZAdmin main force ztele");
//Format(logflags, sizeof(logflags), "%t", "!zadmin main logflags");
// Get conditions for options.
new bool:hitgroups = GetConVarBool(g_hCvarsList[CVAR_HITGROUPS]);
// Add items to menu.
AddMenuItem(menu_zadmin, "classmultipliers", classmultipliers);
AddMenuItem(menu_zadmin, "weapons", weapons);
AddMenuItem(menu_zadmin, "hitgroups", hitgroups);
AddMenuItem(menu_zadmin, "hitgroups", hitgroups, MenuGetItemDraw(hitgroups));
AddMenuItem(menu_zadmin, "infect", infect);
AddMenuItem(menu_zadmin, "zspawn", zspawn);
AddMenuItem(menu_zadmin, "ztele", ztele);