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

[EntProps] Array Ent Prop Has No Offset Value?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
extrospect
Member
Join Date: Aug 2009
Old 05-01-2012 , 14:19   [EntProps] Array Ent Prop Has No Offset Value?
Reply With Quote #1

I'm trying to access the data stored to CTFPlayer detailing the buildings an engineer has built - from using dtwatchent it's become apparent that this information is being stored to the "player_object_array" ent prop:

Console output from dtwatchent when deploying a dispenser:
Code:
+ DT_TFPlayer m_nNewSequenceParity, DPT_Int, index 480, bits 3, value 5
+ DT_TFPlayer 003, DPT_Int, index 217, bits 10, value 100
+ DT_TFPlayer m_nResetEventsParity, DPT_Int, index 481, bits 3, value 5
+ DT_TFPlayer m_hLastWeapon, DPT_Int, index 253, bits 21, value 1303554
+ DT_TFPlayer m_hActiveWeapon, DPT_Int, index 489, bits 21, value 1403908
+ DT_TFPlayer m_flFirstPrimaryAttack, DPT_Float, index 422, bits 32, value 56.245
= 276 bits (35 bytes)

+ DT_TFPlayer "player_object_array", DPT_Array, index 441, bits 24, value Array

+ DT_TFPlayer m_flNextAttack, DPT_Float, index 449, bits 32, value 56.245
delta entity: 1
+ DT_TFPlayer m_nTickBase, DPT_Int, index 4, bits 32, value 3709
= 54 bits (7 bytes)
+ DT_TFPlayer m_flSimulationTime, DPT_Int, index 15, bits 8, value 8
delta entity: 1
+ DT_TFPlayer m_iBuildingsBuilt, DPT_Int, index 351, bits 10, value 1
+ DT_TFPlayer m_nTickBase, DPT_Int, index 4, bits 32, value 3713
+ DT_TFPlayer m_iBuildingsBuilt, DPT_Int, index 371, bits 10, value 1
Relevant area of CTFPlayer from sm_dump_netprops:
Code:
  -Member: m_nPlayerCondEx (offset 180) (type integer) (bits 15)
 -Member: m_hItem (offset 6796) (type integer) (bits 21)
  Sub-Class Table (2 Deep): DT_TFLocalPlayerExclusive
  -Member: m_vecOrigin (offset 724) (type 3) (bits 0)
  -Member: m_vecOrigin[2] (offset 732) (type float) (bits 0)
  -Member: player_object_array_element (offset 0) (type integer) (bits 21)

  -Member: "player_object_array" (offset 0) (type array) (bits 0)

  -Member: m_angEyeAngles[0] (offset 6856) (type float) (bits 8)
  -Member: m_bIsCoaching (offset 6545) (type integer) (bits 1)
  -Member: m_hCoach (offset 6548) (type integer) (bits 21)
  -Member: m_hStudent (offset 6552) (type integer) (bits 21)
  Sub-Class Table (2 Deep): DT_TFNonLocalPlayerExclusive
  -Member: m_vecOrigin (offset 724) (type 3) (bits 0)
The problem I'm facing is I cannot seem to find any sourcemod method which will actually return me a valid offset for either the "player_object_array" or the player_object_array_element properties. Both FindSendPropOffs and FindSendPropInfo return a value of 0.

I'm hoping someone who knows more about this than I do can at least point me in the right direction or tell me if it's even currently possible, as I would love to be able to at least read from this array even if I can't modify the data (which is my ultimate aim).

Thanks for any info or help anyone can provide
extrospect is offline
Powerlord
AlliedModders Donor
Join Date: Jun 2008
Location: Seduce Me!
Old 05-01-2012 , 23:33   Re: [EntProps] Array Ent Prop Has No Offset Value?
Reply With Quote #2

the SourceMod documentation for GetEntDataArray implies that the proper way to read this is:
PHP Code:
    new m_Offset FindSendPropOffs("CTFPlayer""player_object_array_element")
    new 
ArrayValue[64]

    
GetEntDataArray1m_OffsetArrayValue641)
    for (new 
i=0<= 63i++)
    {
        
PrintToServer("Array %i Value: %i"iArrayValue[i])
    } 
(note: this is for player index 1)
__________________
Not currently working on SourceMod plugin development.

Last edited by Powerlord; 05-01-2012 at 23:35.
Powerlord is offline
extrospect
Member
Join Date: Aug 2009
Old 05-02-2012 , 14:59   Re: [EntProps] Array Ent Prop Has No Offset Value?
Reply With Quote #3

Thanks for the reply Powerlord, however, I've already tried all of the examples below and the value returned for the offset from each function call is always zero (or -1 for the last 2 which show the escaped quotes are necessary to access the "player_object_array" property by name).

I'm not sure if maybe the example from the API worked at one point but no longer does, or if it was just an untested example that has never worked, but it seems the standard offset retrieval functions do not work for arrays, or at least not the CTFPlayer "player_object_array" array .

Code:
FindSendPropOffs("CTFPlayer", "player_object_array_element") == 0
FindSendPropInfo ("CTFPlayer", "player_object_array_element") == 0

FindSendPropOffs("CTFPlayer", "\"player_object_array\"") == 0
FindSendPropInfo ("CTFPlayer", "\"player_object_array\"") == 0

FindSendPropOffs("CTFPlayer", "player_object_array") == -1
FindSendPropInfo ("CTFPlayer", "player_object_array") == -1
As an aside, whilst I haven't yet gotten into coding extensions and have only worked with sourcepawn so far, I do have a reasonable amount of C++ programming experience outside of SM and could go that route if anyone thinks that might be the way to solve this problem.

Again, any input on a way around this would be greatly appreciated .

Last edited by extrospect; 05-02-2012 at 15:06.
extrospect is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-03-2012 , 04:59   Re: [EntProps] Array Ent Prop Has No Offset Value?
Reply With Quote #4

That isn't a standard array netprop, you're not going to be able to read it with SourceMod.
__________________
asherkin is offline
extrospect
Member
Join Date: Aug 2009
Old 05-04-2012 , 18:21   Re: [EntProps] Array Ent Prop Has No Offset Value?
Reply With Quote #5

Thanks for the info asherkin , just to clarify - even going the C++/extension route would not afford me access to this array?

What about the approach of using something like DHooks, or creating detours, to modify the parameters/returns of functions which write to and/or read from this array?

Last edited by extrospect; 05-04-2012 at 18:21.
extrospect is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 05-05-2012 , 13:53   Re: [EntProps] Array Ent Prop Has No Offset Value?
Reply With Quote #6

Quote:
Originally Posted by extrospect View Post
Thanks for the info asherkin , just to clarify - even going the C++/extension route would not afford me access to this array?

What about the approach of using something like DHooks, or creating detours, to modify the parameters/returns of functions which write to and/or read from this array?
The netprop doesn't actually exist, it's a dynamically generated wrapper around a CUtlVector stored in the player class.

You could modify it with C++ "easily", and probably also from a SourcePawn plugin using 1.4's memory addressing features, but it would be quite complex to do.
__________________
asherkin is offline
Reply


Thread Tools
Display Modes

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 06:23.


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