just blocking out the hide option from working in settings in case of not having reached the tier yet
This commit is contained in:
parent
e2659d79a6
commit
9e59258ab0
@ -3,6 +3,7 @@
|
|||||||
#include <sdkhooks>
|
#include <sdkhooks>
|
||||||
#include <sourcemod>
|
#include <sourcemod>
|
||||||
#include <zombiereloaded>
|
#include <zombiereloaded>
|
||||||
|
#include <unloze_playtime>
|
||||||
#include <TransmitManager>
|
#include <TransmitManager>
|
||||||
#include <leader>
|
#include <leader>
|
||||||
#include <entWatch_core>
|
#include <entWatch_core>
|
||||||
@ -15,6 +16,7 @@ bool g_bHidePlayers[MAXPLAYERS + 1][MAXPLAYERS + 1];
|
|||||||
/* INTEGERS */
|
/* INTEGERS */
|
||||||
int g_iHideRange[MAXPLAYERS+1];
|
int g_iHideRange[MAXPLAYERS+1];
|
||||||
int g_iLeader = 0;
|
int g_iLeader = 0;
|
||||||
|
int g_iTierHide = 0;
|
||||||
|
|
||||||
/* HANDLES */
|
/* HANDLES */
|
||||||
Handle g_hTimer;
|
Handle g_hTimer;
|
||||||
@ -72,6 +74,7 @@ public void OnPluginStart()
|
|||||||
}
|
}
|
||||||
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Hide");
|
SetCookieMenuItem(MenuHandler_CookieMenu, 0, "Hide");
|
||||||
g_hTimer = CreateTimer(1.0, UpdateHide, INVALID_HANDLE, TIMER_REPEAT);
|
g_hTimer = CreateTimer(1.0, UpdateHide, INVALID_HANDLE, TIMER_REPEAT);
|
||||||
|
g_iTierHide = FindTierForCommandOverride("sm_hide");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnPluginEnd()
|
public void OnPluginEnd()
|
||||||
@ -316,11 +319,85 @@ public int MenuHandler_MainMenu(Menu menu, MenuAction action, int client, int se
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
stock int FindTierForCommandOverride(const char[] command)
|
||||||
|
{
|
||||||
|
char sPath[PLATFORM_MAX_PATH];
|
||||||
|
BuildPath(Path_SM, sPath, sizeof(sPath), "configs/admin_groups.cfg");
|
||||||
|
|
||||||
|
KeyValues kv = new KeyValues("Groups");
|
||||||
|
if (!kv.ImportFromFile(sPath))
|
||||||
|
{
|
||||||
|
delete kv;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
// collect tier group names first
|
||||||
|
char groupNames[32][64];
|
||||||
|
int groupCount = 0;
|
||||||
|
|
||||||
|
if (kv.GotoFirstSubKey())
|
||||||
|
{
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char sName[64];
|
||||||
|
kv.GetSectionName(sName, sizeof(sName));
|
||||||
|
if (StrContains(sName, "tier", false) == 0)
|
||||||
|
{
|
||||||
|
strcopy(groupNames[groupCount], 64, sName);
|
||||||
|
groupCount++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (kv.GotoNextKey() && groupCount < 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
int foundTier = -1;
|
||||||
|
|
||||||
|
for (int i = 0; i < groupCount; i++)
|
||||||
|
{
|
||||||
|
kv.Rewind();
|
||||||
|
|
||||||
|
if (!kv.JumpToKey(groupNames[i]))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!kv.JumpToKey("Overrides"))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (!kv.GotoFirstSubKey(false))
|
||||||
|
continue;
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
char overrideCmd[64];
|
||||||
|
kv.GetSectionName(overrideCmd, sizeof(overrideCmd));
|
||||||
|
|
||||||
|
if (StrEqual(overrideCmd, command, false))
|
||||||
|
{
|
||||||
|
char tierStr[8];
|
||||||
|
strcopy(tierStr, sizeof(tierStr), groupNames[i][4]); // skip "tier"
|
||||||
|
foundTier = StringToInt(tierStr);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
while (kv.GotoNextKey(false));
|
||||||
|
|
||||||
|
if (foundTier != -1)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
delete kv;
|
||||||
|
return foundTier;
|
||||||
|
}
|
||||||
|
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
// Purpose:
|
// Purpose:
|
||||||
//----------------------------------------------------------------------------------------------------
|
//----------------------------------------------------------------------------------------------------
|
||||||
public void MenuHandler_CookieMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen)
|
public void MenuHandler_CookieMenu(int client, CookieMenuAction action, any info, char[] buffer, int maxlen)
|
||||||
{
|
{
|
||||||
|
int client_tier = GetPlayerTier_native(client);
|
||||||
|
if (g_iTierHide > client_tier)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
switch(action)
|
switch(action)
|
||||||
{
|
{
|
||||||
case(CookieMenuAction_DisplayOption):
|
case(CookieMenuAction_DisplayOption):
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user