Raised This Month: $32 Target: $400
 8% 

Solved Get entity KeyValue


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-06-2020 , 10:21   Get entity KeyValue
Reply With Quote #1

There are functions to set entity keyvalues:
DispatchKeyValue
DispatchKeyValueFloat
DispatchKeyValueVector
Which internaly use servertools->KeyValue. And I'm looking for a way to get the values from entities.
In C++ I can use servertools->GetKeyValue, which works and gives correct results.
How can I do that in sourcemod?
I know there are GetEnt* to get sendprop and datamap values but they don't cover all data.

Last edited by kadet.89; 05-08-2020 at 05:30.
kadet.89 is offline
Send a message via Skype™ to kadet.89
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 05-06-2020 , 12:13   Re: Get entity KeyValue
Reply With Quote #2

...I have using Stripper (dump file) for this problem, but it dumps everything from map only.
Bacardi is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-06-2020 , 15:31   Re: Get entity KeyValue
Reply With Quote #3

I've thought of that way, but I need it mostly for dynamically set properties and dynamically created entities.
kadet.89 is offline
Send a message via Skype™ to kadet.89
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 05-06-2020 , 16:45   Re: Get entity KeyValue
Reply With Quote #4

Quote:
Originally Posted by kadet.89
I know there are GetEnt* to get sendprop and datamap values but they don't cover all data.
Are you sure? I'm not a C++ coder but i know that when you dump datamaps (sm_dump_datamaps <file>) and netprops (sm_dump_netprops <file>), SourceMod also logs name of entity key used by specific property.
After all, you can create your own SM extension and add a new native that will call servertools->GetKeyValue.
__________________
MAGNAT2645 is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-07-2020 , 05:48   Re: Get entity KeyValue
Reply With Quote #5

sm_dump* doesn't dump custom keyvalues, only those attached to specific fields inside entity.
Writing an extension would be a solution, but I'd like to avoid it.
kadet.89 is offline
Send a message via Skype™ to kadet.89
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-07-2020 , 06:48   Re: Get entity KeyValue
Reply With Quote #6

If the data is stored in the entity somewhere you can get it with GetEntData* (although most keys that just store data generally use named props because it is easier - and that will be everything GetKeyValue works with as well), if the data isn't stored obviously you can't read it back directly - but you should be able to use DHooks to hook the setter.
__________________
asherkin is offline
MAGNAT2645
Senior Member
Join Date: Nov 2015
Location: AlliedMods.net
Old 05-07-2020 , 06:54   Re: Get entity KeyValue
Reply With Quote #7

Quote:
Originally Posted by kadet.89 View Post
sm_dump* doesn't dump custom keyvalues, only those attached to specific fields inside entity.
Writing an extension would be a solution, but I'd like to avoid it.
Hmm you said custom keyvalues, maybe you need this?
__________________
MAGNAT2645 is offline
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 05-08-2020 , 05:14   Re: Get entity KeyValue
Reply With Quote #8

Thanks, that's exactly what I need
kadet.89 is offline
Send a message via Skype™ to kadet.89
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 09:54.


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