Raised This Month: $51 Target: $400
 12% 

I cant get the string from the keyvalues


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 07-12-2019 , 13:05   I cant get the string from the keyvalues
Reply With Quote #1

I dont know why but the string from "owner" or from "group"

PHP Code:
char g_szOwnerLink[128], g_szGrupLink[128];

public 
void OnPluginStart()
{
    
RegConsoleCmd("sm_owner"OWNER);
    
RegConsoleCmd("sm_grup"GRUP);
    
RegConsoleCmd("sm_group"GRUP);
    
RegConsoleCmd("sm_reloadlinks"OnReload""ADMFLAG_GENERIC);
}

public 
void OnMapStart()
{
    
LoadConfig();
}

public 
Action OnReload(int Clientint Args)
{
    
LoadConfig();
}

void LoadConfig()
{
    
char Configfile[1024];
    
BuildPath(Path_SMConfigfile1024"configs/tz_plugins/teaze_core.cfg");
    
    if(!
FileExists(Configfile))
        
SetFailState("Can not find config file \"%s\"!"Configfile);
    
    
    
KeyValues hKV CreateKeyValues("CORE");
    
hKV.ImportFromFile(Configfile);

    
char sName[1024];
    
hKV.GetSectionName(sNamesizeof(sName));
    
    if (
strcmp(sName"Links") == 0)
    {
        
hKV.GetString("owner"g_szOwnerLinksizeof(g_szOwnerLink));                
        
hKV.GetString("group"g_szGrupLinksizeof(g_szGrupLink));
    }
    else 
hKV.GotoNextKey()
    
hKV.Rewind();
    
delete hKV;
}

public 
Action OWNER(int clientint args)
{
    
PrintToChat(client" * \x02 =========================================");    
    
PrintToChat(client" * \x09 %s"g_szOwnerLink);
    
PrintToChat(client" * \x02 =========================================");
    
PrintToChat(client" * \x09 USE THIS LINK TO ADD THE OWNER");
    
PrintToChat(client" * \x02 =========================================");
    
PrintToChat(client" * \x09 SHIFT + TAB >> WEB BROWSER >> PASTE THE LINK");
    
PrintToChat(client" * \x02 =========================================");
}

public 
Action GRUP(int clientint args)
{
    
PrintToChat(client" * \x02 =========================================");
    
PrintToChat(client" * \x03 %s"g_szGrupLink);
    
PrintToChat(client" * \x02 =========================================");
    
PrintToChat(client" * \x03 USE THIS LINK TO JOIN THE STEAM GROUP");
    
PrintToChat(client" * \x02 =========================================");
    
PrintToChat(client" * \x03 SHIFT + TAB >> WEB BROWSER >> PASTE THE LINK");
    
PrintToChat(client" * \x02 =========================================");

PHP Code:
"CORE"
{
    
"QuakeSounds"
    
{
        
"nadekill_file"            "qs/allahuakbar.mp3"
        "dom_file"                "qs/dominating.mp3"
        "doublekill_file"        "qs/doublekill.mp3"
        "firekill_file"            "qs/firegirl.mp3"
        "firstblood_file"        "qs/firstblood.mp3"
        "godlike_file"            "qs/female/godlike.mp3"
        "knifekill_file"        "qs/humiliation.mp3"
        "rampage_file"            "qs/rampage.mp3"
        "unstoppable_file"        "qs/unstopable.mp3"
        "humilition_file"        "qs/humiliation.mp3"
    
}
    
    
"Links"
    
{
        
"owner"                    "https://steamcommunity.com/id/kratos1812/"
        "group"                    "https://steamcommunity.com/groups/kratoscsgoservergroup"
    
}

__________________
kratoss1812 is offline
Psyk0tik
Veteran Member
Join Date: May 2012
Location: Homeless
Old 07-12-2019 , 14:15   Re: I cant get the string from the keyvalues
Reply With Quote #2

Instead of using KV.GetSectionName along with string comparison, just use KV.JumpToKey.
__________________

Last edited by Psyk0tik; 07-12-2019 at 14:18.
Psyk0tik is offline
kratoss1812
Senior Member
Join Date: May 2018
Location: Romānia
Old 07-12-2019 , 14:43   Re: I cant get the string from the keyvalues
Reply With Quote #3

Quote:
Originally Posted by Crasher_3637 View Post
Instead of using KV.GetSectionName along with string comparison, just use KV.JumpToKey.
Thank you!
__________________
kratoss1812 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:14.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode