Disable hitgroups in the menu if cvar is disabled, stop hitgroup commands from working if hitgroups are disabled.
This commit is contained in:
		| @@ -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++) | ||||
|   | ||||
| @@ -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); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user