PDA

View Full Version : KeyValueBuffer GetValue doesn't work :[



Nero
22-06-2016, 08:19 PM
string GetValue(const string& in szKey) const Gets a key value


KeyValueBuffer@ pInfos = g_EngineFuncs.GetInfoKeyBuffer( pEnt.edict() );
pInfos.GetValue( "whateverkey" );

Always returns an empty string :[

nico
23-06-2016, 12:57 AM
string GetValue(const string& in szKey) const Gets a key value


KeyValueBuffer@ pInfos = g_EngineFuncs.GetInfoKeyBuffer( pEnt.edict() );
pInfos.GetValue( "whateverkey" );

Always returns an empty string :[
Assuming pEnt is pPlayer, it's only for netwoked client cvars. Like model/topcolor/bottomcolor. Dunno if there is more.

Nero
23-06-2016, 01:24 AM
Noes, pEnt is any brush entity.

Well that sucks :[

Making a port of the amx_ent_info command:



const array<string> g_Keyvalues =
{
"classname",
"model",
"targetname",
"displayname",
"target",
"health",
"frags",
"spawnflags",
"distance",
"speed",
"master",
"movesnd",
"stopsnd",
"noise",
"noise1",
"noise2",
"delay",
"wait",
"lip",
"dmg",
"message",
"_minlight",
"soundlist",
"m_iOpenFlags",
"m_fIgnoreTargetname",
"m_iObeyTriggerMode",
"breakable",
"fireonbreak",
"material",
"instantbreak",
"weapon",
"explosion",
"gibmodel",
"explodemagnitude",
"onlytrigger",
"breakontrigger",
"repairable",
"showhudinfo",
"immunetoclients",
"explosivesonly",
"volume",
"height",
"spawnobject",
"locked_sound",
"unlocked_sound",
"locked_sentence",
"unlocked_sentence",
"locked_sound_override",
"unlocked_sound_override",
"locked_sentence_override",
"unlocked_sentence_override",
"fireonopen",
"netname",
"sounds",
"modifier",
"style",
"skin",
"damp",
"rotation",
"minhullsize",
"maxhullsize",
"friction",
"buoyancy",
"changetarget",
"fanfriction",
"spawnorigin",
"bullet",
"laserentity",
"iMagnitude",
"wheels",
"startspeed",
"bank",
"avelocity",
"WaveHeight",
"globalname",
"killtarget",
"rendermode",
"renderfx",
"renderamt",
"rendercolor",
"item_name_required",
"item_group_required",
"item_group_required_num",
"item_name_canthave",
"item_group_canthave",
"item_group_canthave_num",
"pass_drop_item_name",
"pass_drop_item_group",
"pass_return_item_name",
"pass_return_item_group",
"pass_destroy_item_name",
"pass_destroy_item_group",
"target_on_fail",
"classify",
"angles",
"movetype",
"zhlt_usemodel",
"zhlt_copylight",
"zhlt_lightflags",
"light_origin",
"dmgdelay",
"CustomJuice",
"CustomRechargeTime",
"TriggerOnEmpty",
"TriggerOnRecharged",
"CustomDeniedSound",
"CustomStartSound",
"CustomLoopSound",
"toptrack",
"bottomtrack",
"yawrate",
"yawrange",
"yawtolerance",
"pitchrate",
"pitchrange",
"pitchtolerance",
"barrel",
"barrely",
"barrelz",
"spritesmoke",
"spriteflash",
"spritescale",
"rotatesound",
"firerate",
"bullet_damage",
"persistence",
"firespread",
"minRange",
"maxRange",
"relation_player",
"relation_none",
"relation_machine",
"relation_human_passive",
"relation_human_militar",
"relation_alien_militar",
"relation_alien_passive",
"relation_alien_monster",
"relation_alien_prey",
"relation_alien_predator",
"relation_insect",
"relation_player_ally",
"relation_player_bioweapon",
"relation_monster_bioweapon",
"relation_machine",
"m_flSpread",
"m_iCount",
"m_fControl",
"m_iszXController",
"m_iszYController",
"mortar_axis"
};

for( uint i = 0; i < g_Keyvalues.length(); i++ )
{
if( pInfos.GetValue( g_Keyvalues[i] ) != "" )
g_PlayerFuncs.ClientPrint( pPlayer, HUD_PRINTCONSOLE, g_Keyvalues[i] + " = \"" + pInfos.GetValue( g_Keyvalues[i] ) + "\"\n" );
}

w00tguy123
13-07-2016, 07:40 PM
+1 to this sucking. It doesn't seem to be possible to set a non-standard keyvalue on an entity either (ex: setting the "map" key on a trigger_changelevel).

I would have thought using KeyValue() or DispatchKeyvalue() on the entity would work like with custom entities, but it doesn't for whatever reason.

Julcoool
13-07-2016, 07:46 PM
Fill me in here, KeyValueBuffer = KVD? If I'm correct about this assumption, then those values can only be retrieved on map precache, try MapInit()


It doesn't seem to be possible to set a non-standard keyvalue on an entity either (ex: setting the "map" key on a trigger_changelevel).

KeyValue?


changelevelentity.KeyValue( "map", "newvalue" );

w00tguy123
13-07-2016, 07:49 PM
^ Keyvalue() doesn't work.

If it's only supposed to work during MapInit() then we're stuck again because you can't access map entities during that time. Only in MapActivate() or later can you scan through the entities.

Selekt0r
14-07-2016, 02:28 AM
Doesn't trigger_changelevel's value get overridden by some map cfg setting? mp_nextmap or something? A programmer should elaborate on how this all works.

spy-warrior
14-07-2016, 04:57 AM
commande: next_survival_map in Survival.as