mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-07 18:38:26 +00:00
Add cookies for sm_hide (#311)
This commit is contained in:
parent
fc45e60ba0
commit
a9cf7a32f3
@ -23,6 +23,7 @@
|
|||||||
#include <sdktools>
|
#include <sdktools>
|
||||||
#include <sdkhooks>
|
#include <sdkhooks>
|
||||||
#include <dynamic>
|
#include <dynamic>
|
||||||
|
#include <clientprefs>
|
||||||
|
|
||||||
#undef REQUIRE_EXTENSIONS
|
#undef REQUIRE_EXTENSIONS
|
||||||
#include <dhooks>
|
#include <dhooks>
|
||||||
@ -53,6 +54,9 @@ char gS_CurrentMap[192];
|
|||||||
ConVar gCV_Hostname = null;
|
ConVar gCV_Hostname = null;
|
||||||
ConVar gCV_Hostport = null;
|
ConVar gCV_Hostport = null;
|
||||||
|
|
||||||
|
// cookies
|
||||||
|
Handle gH_HideCookie = null;
|
||||||
|
|
||||||
// cvars
|
// cvars
|
||||||
ConVar gCV_GodMode = null;
|
ConVar gCV_GodMode = null;
|
||||||
ConVar gCV_PreSpeed = null;
|
ConVar gCV_PreSpeed = null;
|
||||||
@ -149,6 +153,7 @@ public void OnPluginStart()
|
|||||||
// hide
|
// hide
|
||||||
RegConsoleCmd("sm_hide", Command_Hide, "Toggle players' hiding.");
|
RegConsoleCmd("sm_hide", Command_Hide, "Toggle players' hiding.");
|
||||||
RegConsoleCmd("sm_unhide", Command_Hide, "Toggle players' hiding.");
|
RegConsoleCmd("sm_unhide", Command_Hide, "Toggle players' hiding.");
|
||||||
|
gH_HideCookie = RegClientCookie("shavit_hide", "Hide settings", CookieAccess_Protected);
|
||||||
|
|
||||||
// tpto
|
// tpto
|
||||||
RegConsoleCmd("sm_tpto", Command_Teleport, "Teleport to another player. Usage: sm_tpto [target]");
|
RegConsoleCmd("sm_tpto", Command_Teleport, "Teleport to another player. Usage: sm_tpto [target]");
|
||||||
@ -271,11 +276,33 @@ public void OnPluginStart()
|
|||||||
if(IsValidClient(i))
|
if(IsValidClient(i))
|
||||||
{
|
{
|
||||||
OnClientPutInServer(i);
|
OnClientPutInServer(i);
|
||||||
|
|
||||||
|
if(AreClientCookiesCached(i))
|
||||||
|
{
|
||||||
|
OnClientCookiesCached(i);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnClientCookiesCached(int client)
|
||||||
|
{
|
||||||
|
char[] sHideSetting = new char[8];
|
||||||
|
GetClientCookie(client, gH_HideCookie, sHideSetting, 8);
|
||||||
|
|
||||||
|
if(strlen(sHideSetting) == 0)
|
||||||
|
{
|
||||||
|
SetClientCookie(client, gH_HideCookie, "0");
|
||||||
|
gB_Hide[client] = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
gB_Hide[client] = view_as<bool>(StringToInt(sHideSetting));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void Shavit_OnStyleConfigLoaded(int styles)
|
public void Shavit_OnStyleConfigLoaded(int styles)
|
||||||
{
|
{
|
||||||
if(styles == -1)
|
if(styles == -1)
|
||||||
@ -665,7 +692,10 @@ public Action OnPlayerRunCmd(int client, int &buttons)
|
|||||||
|
|
||||||
public void OnClientPutInServer(int client)
|
public void OnClientPutInServer(int client)
|
||||||
{
|
{
|
||||||
gB_Hide[client] = false;
|
if(!AreClientCookiesCached(client))
|
||||||
|
{
|
||||||
|
gB_Hide[client] = false;
|
||||||
|
}
|
||||||
|
|
||||||
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
|
SDKHook(client, SDKHook_OnTakeDamage, OnTakeDamage);
|
||||||
SDKHook(client, SDKHook_SetTransmit, OnSetTransmit);
|
SDKHook(client, SDKHook_SetTransmit, OnSetTransmit);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user