@@ -51,7 +51,7 @@ Handle fTagsUpdated;
5151Handle fMessageProcess ;
5252Handle fMessageProcessed ;
5353Handle fMessagePreProcess ;
54- Handle g_hPref_HideTags ;
54+ Handle hVibilityCookie ;
5555
5656DataPack dataOrder ;
5757
@@ -133,7 +133,7 @@ public void OnPluginStart()
133133 if (! HookEventEx (" round_end" , Event_RoundEnd ))
134134 LogError (" Failed to hook \" round_end\" , \" sm_hextags_roundend\" won't produce any effect." );
135135
136- g_hPref_HideTags = RegClientCookie (" Hextags_Visability " , " Show or hide the tags." , CookieAccess_Private );
136+ hVibilityCookie = RegClientCookie (" HexTags_Visibility " , " Show or hide the tags." , CookieAccess_Private );
137137
138138#if defined DEBUG
139139 RegConsoleCmd (" sm_gettagvars" , Cmd_GetVars );
@@ -155,27 +155,18 @@ public void OnAllPluginsLoaded()
155155 bSteamWorks = LibraryExists (" SteamWorks" );
156156
157157 LoadKv ();
158- if (bLate ) for (int i = 1 ; i <= MaxClients ; i ++ )if (IsClientInGame (i ))OnClientPostAdminCheck (i );
158+ if (bLate ) for (int i = 1 ; i <= MaxClients ; i ++ )if (IsClientInGame (i ))
159+ {
160+ if (! AreClientCookiesCached (i ))
161+ OnClientCookiesCached (i );
162+ OnClientPostAdminCheck (i );
163+ }
159164
160165 //Timers
161166 if (bCSGO )
162167 CreateTimer (5.0 , Timer_ForceTag , _ , TIMER_REPEAT );
163168}
164169
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- }
178-
179170public void OnLibraryAdded (const char [] name )
180171{
181172 Debug_Print (" Called OnLibraryAdded %s " , name );
@@ -340,7 +331,7 @@ public Action Cmd_ToggleTags(int client, int args)
340331 ReplyToCommand (client , " [SM] Your tags are no longer visible." );
341332 }
342333
343- SetClientCookie (client , g_hPref_HideTags , bHideTag [client ] ? " 1 " : " 0 " );
334+ SetClientCookie (client , hVibilityCookie , bHideTag [client ] ? " 0 " : " 1 " );
344335}
345336
346337public Action Cmd_GetTeam (int client , int args )
@@ -368,6 +359,14 @@ public void OnClientPostAdminCheck(int client)
368359 LoadTags (client );
369360}
370361
362+ public void OnClientCookiesCached (int client )
363+ {
364+ char sValue [8 ];
365+ GetClientCookie (client , hVibilityCookie , sValue , sizeof (sValue ));
366+
367+ bHideTag [client ] = sValue [0 ] == ' \0 ' ? false : ! StringToInt (sValue );
368+ }
369+
371370public Action RankMe_OnPlayerLoaded (int client )
372371{
373372 RankMe_GetRank (client , RankMe_LoadTags );
@@ -396,7 +395,6 @@ public Action RankMe_LoadTags(int client, int rank, any data)
396395 ReplaceString (sTags [client ][ScoreTag ], sizeof (sTags [][]), " {rmRank } " , sRank );
397396 CS_SetClientClanTag (client , sTags [client ][ScoreTag ]); //Instantly load the score-tag
398397 }
399-
400398}
401399
402400public Action CP_OnChatMessage (int & author , ArrayList recipients , char [] flagstring , char [] name , char [] message , bool & processcolors , bool & removecolors )
0 commit comments