View Single Post
jenZ
Junior Member
Join Date: May 2013
Old 07-08-2018 , 05:11   Re: [ANY]HexTags[Chat/Score Colors][08/02/18]
Reply With Quote #106

Hello i like this plugin alot so i went ahead and made some small bad modifications to suit my own needs however i caused myself some problems and hope you could help me pinpoint what im doing wrong.

Its about KeyValues and KeyValues.JumpToKey failing for me on random ocassions while working on others.

i have a file called playerprefs.ChatColors.txt which content is:
Quote:
"ChatColors"
{
"STEAM_1:14783317"
{
"color" "orchid"
}
}
on OnClientPostAdminCheck i do the following:

Quote:
g_hChatColor.Rewind();
static char sAuth[32];
GetClientAuthId(client, AuthId_Steam2, sAuth, sizeof(sAuth));

if (g_hChatColor.JumpToKey(sAuth, false))
{
g_hChatColor.GetString("Color", ChatTagColor[client], sizeof(ChatTagColor));
}
else
{
Format(ChatTagColor[client], sizeof(ChatTagColor), "default");
}
With this i read the value from the .txt file to assign a color to each player on connect if they have an stored entry.

CP_OnChatMessage then has the following:
Quote:
Format(sNewName, MAXLENGTH_NAME, "{%s}[%s] %s%s{default}", ChatTagColor[i], ChatTagchat[i], sTags[author][NameColor], name);
Format(sNewMessage, MAXLENGTH_MESSAGE, "%s%s", sTags[author][ChatColor], message);
on average in 4/5 reconnects that i do to the server the keyvalue suceeds with jumptokey (i tested around 3 hours yesterday). But the one other time the jumptokey method fails on me while entry is still untouched.

I feel rather confused about the jumptokey method appearing inconsistent to me right now.

Welp, thanks for reading.

Edit: ohwell nevermind it seems consistent now with jumptokey when values exist. I added ImportFromFile for the keyvalue on OnClientPostAdminCheck and now it seems to work correct everytime.

Last edited by jenZ; 07-08-2018 at 06:07. Reason: Fixed issue myself
jenZ is offline