Thread: [Solved] KeyValues not working
View Single Post
SpirT
Senior Member
Join Date: Sep 2018
Location: Portugal
Old 02-24-2021 , 04:12   Re: KeyValues not working
Reply With Quote #3

Quote:
Originally Posted by DJ Tsunami View Post
You're passing true to JumpToKey to create the key if it doesn't exist, so naturally it will always return true. Then you need to use ExportToFile to make the key show up in the file.
Thanks for the reply DJ Tsunami. Therefore, should it just be like this? :
PHP Code:
{
        
KeyValues kv = new KeyValues("VIPTags");
    
kv.ImportFromFile(filePath);
    
    
KvGotoFirstSubKey(kv);
    
    if(
kv.JumpToKey(steamIDtrue))
    {
        
PrintToServer("Couldn't find a key for %s but we'll try to create it."steamID);
        
KvGetString(kv"scoretag"scoreTag[client], sizeof(scoreTag[]), "Teste - ");
        
KvSetString(kv"chatcolor"chatColor[client], sizeof(chatColor[]), "{red}");
        
KvSetString(kv"namecolor"nameColor[client], sizeof(nameColor[]), "{blue}");
        
kv.ExportToFile(filePath);
        
delete kv;
        return;
    }

__________________

Last edited by SpirT; 02-24-2021 at 04:12.
SpirT is offline