hud client cookie
This commit is contained in:
		
							parent
							
								
									8d77c73a88
								
							
						
					
					
						commit
						24a3a21d55
					
				@ -6,6 +6,7 @@
 | 
			
		||||
#define g_dIndex 65
 | 
			
		||||
#include <sourcemod>
 | 
			
		||||
#include <colorvariables>
 | 
			
		||||
#include <clientprefs>
 | 
			
		||||
#include <unloze_zones>
 | 
			
		||||
#include <unloze_racetimer_specialmaps>
 | 
			
		||||
#include <unloze_racetimer_antizones>
 | 
			
		||||
@ -32,6 +33,7 @@ int g_iClientChecking[MAXPLAYERS + 1];
 | 
			
		||||
bool g_bDisplaySpecial;
 | 
			
		||||
bool g_bHumansAllowedTime[MAXPLAYERS + 1];
 | 
			
		||||
bool g_bHideTimer[MAXPLAYERS + 1];
 | 
			
		||||
Handle g_hClientCookie = INVALID_HANDLE;
 | 
			
		||||
Database g_dDatabase;
 | 
			
		||||
Handle hText;
 | 
			
		||||
public Plugin myinfo = 
 | 
			
		||||
@ -56,6 +58,16 @@ public void OnPluginStart()
 | 
			
		||||
	HookEvent("round_start", Event_RoundStart, EventHookMode_PostNoCopy);
 | 
			
		||||
	//HUD
 | 
			
		||||
	hText = CreateHudSynchronizer();
 | 
			
		||||
	//cookies
 | 
			
		||||
	g_hClientCookie = RegClientCookie("hide_timer_cookie", "Hides the timer HUD", CookieAccess_Private);
 | 
			
		||||
	for (int i = MaxClients; i > 0; --i)
 | 
			
		||||
	{
 | 
			
		||||
		if (!AreClientCookiesCached(i))
 | 
			
		||||
		{
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		OnClientCookiesCached(i);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
//----------------------------------------------------------------------------------------------------
 | 
			
		||||
// Purpose: 
 | 
			
		||||
@ -132,7 +144,15 @@ public void OnClientPostAdminCheck(int client)
 | 
			
		||||
	resetClient(client);
 | 
			
		||||
	MYSQLCheckRecord(client);
 | 
			
		||||
	g_bHumansAllowedTime[client] = false;
 | 
			
		||||
	g_bHideTimer[client] = false;
 | 
			
		||||
}
 | 
			
		||||
//----------------------------------------------------------------------------------------------------
 | 
			
		||||
// Purpose: 
 | 
			
		||||
//----------------------------------------------------------------------------------------------------
 | 
			
		||||
public void OnClientCookiesCached(int client)
 | 
			
		||||
{
 | 
			
		||||
	char sValue[8];
 | 
			
		||||
	GetClientCookie(client, g_hClientCookie, sValue, sizeof(sValue));
 | 
			
		||||
	g_bHideTimer[client] = (sValue[0] != '\0' && !!StringToInt(sValue));
 | 
			
		||||
}
 | 
			
		||||
//----------------------------------------------------------------------------------------------------
 | 
			
		||||
// Purpose: 
 | 
			
		||||
@ -152,7 +172,6 @@ public void resetClient(int client)
 | 
			
		||||
	g_iClientStage[client] = 0;
 | 
			
		||||
	g_bHumansAllowedTime[client] = false;
 | 
			
		||||
	resetClientVectors(client);
 | 
			
		||||
	g_bHideTimer[client] = false;
 | 
			
		||||
	for (int iterator = 0; iterator < 100; iterator++) 
 | 
			
		||||
	{
 | 
			
		||||
		g_iRecordMinutes[client][iterator] = 0;
 | 
			
		||||
@ -727,8 +746,9 @@ public Action cmd_hideTimerHUD(int client, int args)
 | 
			
		||||
	if (!g_bHideTimer[client])
 | 
			
		||||
	{
 | 
			
		||||
		g_bHideTimer[client] = true;
 | 
			
		||||
		SetClientCookie(client, g_hClientCookie, "1");
 | 
			
		||||
		PrintToChat(client, "Disabled timer HUD");
 | 
			
		||||
	} else { g_bHideTimer[client] = false; PrintToChat(client, "Enabled timer HUD"); }
 | 
			
		||||
	} else { g_bHideTimer[client] = false; PrintToChat(client, "Enabled timer HUD"); SetClientCookie(client, g_hClientCookie, "0"); }
 | 
			
		||||
}
 | 
			
		||||
//----------------------------------------------------------------------------------------------------
 | 
			
		||||
// Purpose: 
 | 
			
		||||
 | 
			
		||||
		Loading…
	
		Reference in New Issue
	
	Block a user