AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   How do you get an ents key values in Fakemeta's FM_KeyValue? (https://forums.alliedmods.net/showthread.php?t=28918)

vittu 05-25-2006 19:35

How do you get an ents key values in Fakemeta's FM_KeyValue?
 
Can someone please explain how to use Fakemeta to get key values from the FM_KeyValue forward (without using the Engine module). I've tried to use get_kvd, which I probably used incorrectly. But I also noticed in the include it said on FM_KeyValue "-- does't work as of 0.20 RC2", though it seems to work as that part of the code gets run.

I wrote this up really quick so you can see what im asking for (not exactly what I'm doing but close enough):
Code:
new TriggerHurtHealers[200] new Total public plugin_init() {     register_plugin("Find_KVD", "0.0", "this isnt a plugin") } public plugin_precache() {     register_forward(FM_KeyValue, "check_keyvalues", 1) } public check_keyvalues(entid) {     if ( pev_valid(entid) )     {         new classname[32], key[32], value[32]         pev(entid, pev_classname, classname, 31)         // Tried these, but I don't quite understand how to use them, not sure what a kvd_handle is         //get_kvd(0, KV_ClassName, classname, 31) //can get this with pev instead         //get_kvd(0, KV_KeyName, key, 31)         //get_kvd(0, KV_Value, value, 31)         // how would you get the entity's KeyValue name and KeyValue value here using Fakemeta?         if ( equali(classname, "trigger_hurt") )             if ( equali(key, "dmg") )                 if ( floatstr(value) <= 0.0 )                     TriggerHurtHealers[Total++] = entid     } }

VEN 05-26-2006 10:52

I tried to pass actual handle, global handle and couldn't retrieve kvdata as well. Probably a bug.

vittu 05-27-2006 05:18

Can you tell me what the actual global handle is as I do not know what kvd_handle is supposed to be exactly...

Can anyone else please attempt to see if the can get it to work or use a different method with fakemeta (Rukia, Damaged Soul or Orangutanz), so that i don't feel like I'm trying to do something that can't be done...

and thanks for trying VEN, just glad to know I wasn't the only one.

VEN 05-27-2006 13:43

By the analogy to dllfunc, hook should also pass a handle in the second parameter. I tried global (0) handle and one which passed to the hook without success.
if KV_fHandled value is true that means that the game mod understood a given kvdata.
I showed thal link to faluco and he said he will see later.

EDIT: Tried pre/post hook, global/specific handle w/o success.

vittu 06-01-2006 18:16

Yea I didn't realize FM_KeyValue forward was passing a second parameter, the handle (or id of the kvd, at least i think that's what it is?). Bail explained this to me and I added the second parameter into the function which cleared up everything.
I changed:
public check_keyvalues(entid)
to
public check_keyvalues(entid, kvd_id)
then got the get_kvd natives to work using kvd_id as the kvd_handle...


thx VEN... and Bailopan.


All times are GMT -4. The time now is 16:33.

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