2727#include <geoip>
2828#include <hexstocks>
2929#include <hextags>
30+ #include <clientprefs>
3031
3132#undef REQUIRE_EXTENSIONS
3233#undef REQUIRE_PLUGIN
@@ -50,6 +51,7 @@ Handle fTagsUpdated;
5051Handle fMessageProcess ;
5152Handle fMessageProcessed ;
5253Handle fMessagePreProcess ;
54+ Handle g_hPref_HideTags ;
5355
5456DataPack dataOrder ;
5557
@@ -130,6 +132,8 @@ public void OnPluginStart()
130132 //Event hooks
131133 if (! HookEventEx (" round_end" , Event_RoundEnd ))
132134 LogError (" Failed to hook \" round_end\" , \" sm_hextags_roundend\" won't produce any effect." );
135+
136+ g_hPref_HideTags = RegClientCookie (" Hextags_Visability" , " Show or hide the tags." , CookieAccess_Private );
133137
134138#if defined DEBUG
135139 RegConsoleCmd (" sm_gettagvars" , Cmd_GetVars );
@@ -158,6 +162,19 @@ public void OnAllPluginsLoaded()
158162 CreateTimer (5.0 , Timer_ForceTag , _ , TIMER_REPEAT );
159163}
160164
165+ public void OnClientCookiesCached (int client )
166+ {
167+ char sValue [8 ];
168+ GetClientCookie (client , g_hPref_HideTags , sValue , sizeof (sValue ));
169+
170+ if (strlen (sValue ) == 0 )
171+ {
172+ strcopy (sValue , sizeof (sValue ), " 1" );
173+ SetClientCookie (client , g_hPref_HideTags , " 1" );
174+ }
175+
176+ bHideTag [client ] = (sValue [0 ] != ' \0 ' && StringToInt (sValue ));
177+ }
161178
162179public void OnLibraryAdded (const char [] name )
163180{
@@ -322,6 +339,8 @@ public Action Cmd_ToggleTags(int client, int args)
322339 CS_SetClientClanTag (client , " " );
323340 ReplyToCommand (client , " [SM] Your tags are no longer visible." );
324341 }
342+
343+ SetClientCookie (client , g_hPref_HideTags , bHideTag [client ] ? " 1" : " 0" );
325344}
326345
327346public Action Cmd_GetTeam (int client , int args )
0 commit comments