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

String to KeyValues


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
KissLick
Veteran Member
Join Date: Nov 2012
Location: void
Old 11-15-2013 , 09:43   String to KeyValues
Reply With Quote #1

Ciao,

is there any possibility how to convert string to KeyValues tree? I need something like:

PHP Code:
// example inspired by https://wiki.alliedmods.net/KeyValues_(SourceMod_Scripting)#Basic_Lookup

new String:MyDataString[256] = "\"MyStructure\"{ \"STEAM_0:0:7\"{ \"name\" \"crab\"} }";
.
.
.
.
GetNameFromSteamIDPlayerSteamIDPlayerName32MyDataString ); // PlayerSteamID and PlayerName are just for example
.
.
.
.
bool:GetNameFromSteamID(const String:steamid[], String:name[], maxlengthString:DataString[])
{
    new 
Handle:kv CreateKeyValues("MyStructure");

    
StringToKeyValues(kvDataString); // need this function

    
if (!KvJumpToKey(kvsteamid))
    {
        return 
false;
    }
    
KvGetString(kv"name"namemaxlength);
    
CloseHandle(kv);
    return 
true;

I don't wanna make a new file with KeyValues structure and then convert this file to KeyValues. I wanna make string (e.g. pass throw function argument) ang this string convert to KeyValues.

Last edited by KissLick; 11-15-2013 at 10:37.
KissLick is offline
 



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 20:40.


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