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\"} }";
.
.
.
.
GetNameFromSteamID( PlayerSteamID, PlayerName, 32, MyDataString ); // PlayerSteamID and PlayerName are just for example
.
.
.
.
bool:GetNameFromSteamID(const String:steamid[], String:name[], maxlength, String:DataString[])
{
new Handle:kv = CreateKeyValues("MyStructure");
StringToKeyValues(kv, DataString); // need this function
if (!KvJumpToKey(kv, steamid))
{
return false;
}
KvGetString(kv, "name", name, maxlength);
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.