mirror of
https://github.com/shavitush/bhoptimer.git
synced 2025-12-09 19:38:25 +00:00
add sm_toggleadverts for someone special
This commit is contained in:
parent
8b971c9dd7
commit
4d91c49d60
@ -102,6 +102,7 @@ float gF_PauseEyeAngles[MAXPLAYERS+1][3];
|
|||||||
// cookies
|
// cookies
|
||||||
Handle gH_HideCookie = null;
|
Handle gH_HideCookie = null;
|
||||||
Handle gH_CheckpointsCookie = null;
|
Handle gH_CheckpointsCookie = null;
|
||||||
|
Cookie gH_BlockAdvertsCookie = null;
|
||||||
|
|
||||||
// cvars
|
// cvars
|
||||||
Convar gCV_GodMode = null;
|
Convar gCV_GodMode = null;
|
||||||
@ -290,6 +291,8 @@ public void OnPluginStart()
|
|||||||
gA_Advertisements = new ArrayList(300);
|
gA_Advertisements = new ArrayList(300);
|
||||||
hostname = FindConVar("hostname");
|
hostname = FindConVar("hostname");
|
||||||
hostport = FindConVar("hostport");
|
hostport = FindConVar("hostport");
|
||||||
|
RegConsoleCmd("sm_toggleadverts", Command_ToggleAdverts, "Toggles visibility of advertisements");
|
||||||
|
gH_BlockAdvertsCookie = new Cookie("shavit-blockadverts", "whether to block shavit-misc advertisements", CookieAccess_Private);
|
||||||
|
|
||||||
// cvars and stuff
|
// cvars and stuff
|
||||||
gCV_GodMode = new Convar("shavit_misc_godmode", "3", "Enable godmode for players?\n0 - Disabled\n1 - Only prevent fall/world damage.\n2 - Only prevent damage from other players.\n3 - Full godmode.", 0, true, 0.0, true, 3.0);
|
gCV_GodMode = new Convar("shavit_misc_godmode", "3", "Enable godmode for players?\n0 - Disabled\n1 - Only prevent fall/world damage.\n2 - Only prevent damage from other players.\n3 - Full godmode.", 0, true, 0.0, true, 3.0);
|
||||||
@ -890,6 +893,17 @@ public Action Timer_Advertisement(Handle timer)
|
|||||||
{
|
{
|
||||||
if(IsClientConnected(i) && IsClientInGame(i))
|
if(IsClientConnected(i) && IsClientInGame(i))
|
||||||
{
|
{
|
||||||
|
if(AreClientCookiesCached(i))
|
||||||
|
{
|
||||||
|
char sCookie[2];
|
||||||
|
gH_BlockAdvertsCookie.Get(i, sCookie, sizeof(sCookie));
|
||||||
|
|
||||||
|
if (sCookie[0] == '1')
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
char sTempMessage[300];
|
char sTempMessage[300];
|
||||||
gA_Advertisements.GetString(gI_AdvertisementsCycle, sTempMessage, 300);
|
gA_Advertisements.GetString(gI_AdvertisementsCycle, sTempMessage, 300);
|
||||||
|
|
||||||
@ -1612,6 +1626,19 @@ public Action Command_Spec(int client, int args)
|
|||||||
return Plugin_Handled;
|
return Plugin_Handled;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Action Command_ToggleAdverts(int client, int args)
|
||||||
|
{
|
||||||
|
if (IsValidClient(client))
|
||||||
|
{
|
||||||
|
char sCookie[4];
|
||||||
|
gH_BlockAdvertsCookie.Get(client, sCookie, sizeof(sCookie));
|
||||||
|
gH_BlockAdvertsCookie.Set(client, (sCookie[0] == '1') ? "0" : "1");
|
||||||
|
Shavit_PrintToChat(client, "%T", (sCookie[0] == '1') ? "AdvertisementsEnabled" : "AdvertisementsDisabled", client);
|
||||||
|
}
|
||||||
|
|
||||||
|
return Plugin_Handled;
|
||||||
|
}
|
||||||
|
|
||||||
public Action Command_Teleport(int client, int args)
|
public Action Command_Teleport(int client, int args)
|
||||||
{
|
{
|
||||||
if(!IsValidClient(client))
|
if(!IsValidClient(client))
|
||||||
|
|||||||
@ -199,4 +199,12 @@
|
|||||||
"#format" "{1:s},{2:s}"
|
"#format" "{1:s},{2:s}"
|
||||||
"en" "{1}NEW {2} WR!!!"
|
"en" "{1}NEW {2} WR!!!"
|
||||||
}
|
}
|
||||||
|
"AdvertisementsEnabled"
|
||||||
|
{
|
||||||
|
"en" "Advertisements enabled"
|
||||||
|
}
|
||||||
|
"AdvertisementsDisabled"
|
||||||
|
{
|
||||||
|
"en" "Advertisements disabled"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user