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

Utilize data structures?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-21-2018 , 21:36   Utilize data structures?
Reply With Quote #1

Hey,

I've got this structure for CBaseCombatCharacter. How do i access its offsets? I need to access m_bPreventWeaponPickup to check if weapon pickup is prevented.

Would this be the appropriate way? I was trying out FindDataMapInfo, but couldn't figure how to check each slot?

PHP Code:
int offset    =    FindDataMapInfo(client"m_bPreventWeaponPickup"); 
PHP Code:
00000000 CBaseCombatCharacter_data struc ; (sizeof=0x284align=0x4copyof_1628)
00000000                                         XREFCTerrorPlayer/r
00000000 m_bForceServerRagdoll db 
?
00000001 m_bPreventWeaponPickup db ?
00000002                 db ? ; undefined
00000003                 db 
? ; undefined
00000004 m_flNextAttack  dd 
?
00000008 m_eHull         dd ?
0000000C m_bloodColor    dd ?
00000010 m_flFieldOfView dd ?
00000014 m_HackedGunPos  dd 3 dup(?)
00000020 m_RelationshipString dd ?               ; offset
00000024 m_impactEnergyScale dd 
?
00000028 m_weaponIDToIndex db 38 dup(?)
0000004E padding78       db 2 dup(?)
00000050 unknown80       db 16 dup(?)
00000060 m_LastHitGroup  dd ?
00000064 m_flDamageAccumulator dd ?
00000068 m_iDamageCount  dd ?
0000006C m_CurrentWeaponProficiency dd ?
00000070 m_Relationship  CBaseCombatCharacter_data::$FC97C2D5179B673732A0DC867F085A11 ?
00000084 m_hTriggerFogList CBaseCombatCharacter_data::$224CB0AA08B9BFA50E253E796AA37A5A ?
00000098 m_hLastFogTrigger dd ?
0000009C m_iAmmo         dd 32 dup(?)
0000011C m_hMyWeapons    dd 64 dup(?)
0000021C m_hActiveWeapon dd ?
00000220 UnknownITimer544 IntervalTimer ?
00000228 m_iUnknown552   dd ?
0000022C m_iUnknown556   dd ?
00000230 UnknownITimer560 IntervalTimer ?
00000238 m_iUnknown568   dd ?
0000023C UnknownITimer572 IntervalTimer ?
00000244 m_iUnknown580   dd ?
00000248 UnknownITimer584 IntervalTimer ?
00000250 m_iUnknown592   dd ?
00000254 UnknownITimer596 IntervalTimer ?
0000025C m_lastNavArea   dd ?                    ; offset
00000260 m_NavAreaUpdateMonitor CAI_MoveMonitor 
?
00000270 m_registeredNavTeam dd ?
00000274 UnknownCTimer628 CountdownTimer ?
00000280 m_iLastUnknown  dd ?
00000284 CBaseCombatCharacter_data ends 
__________________
Spirit_12 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 09-21-2018 , 22:21   Re: Utilize data structures?
Reply With Quote #2

The offsets you've provided aren't absolute; CBaseCombatCharacter is a subclass of other classes with properties.

There is a datamap dump for L4D2 here. m_bPreventWeaponPickup is a named property (at offset 6105); just use GetEntProp(client, Prop_Data, "m_bPreventWeaponPickup") to access it.

For properties that aren't defined as a netprop / dataprop, you'd probably opt for offsets relative to a named property (e.g., to access m_weaponIDToIndex you'd call FindDataMapInfo to get the offset for the named property m_impactEnergyScale, add 0x04, then use GetEntData to read it -- well, you'll probably need to read out the bytes as a string since it's a 38-byte char array).

It sounds like you're using this as reference, which has a comment right above your struct stating the offset is 6092 bytes relative to the CTerrorPlayer entity address.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)

Last edited by nosoop; 09-21-2018 at 22:28.
nosoop is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-22-2018 , 00:10   Re: Utilize data structures?
Reply With Quote #3

Hmm so how would I switch between slots?

Thanks for your input as always. You have been a real help.
__________________
Spirit_12 is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 09-22-2018 , 09:50   Re: Utilize data structures?
Reply With Quote #4

I'm not sure what "slots" refers to in this context. Weapon slots?

I don't have a deep-level understanding of L4D2 (only played it casually), but if m_bPreventWeaponPickup changes depending on the weapon, you'll have to continue browsing through the assembly for modifications to that offset (6105 being 17D9 in hex).

I believe you can set a watchpoint on the memory address as well in GDB; have never done it myself, though.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop is offline
Spirit_12
Veteran Member
Join Date: Dec 2012
Location: Toronto, CA
Old 09-22-2018 , 21:00   Re: Utilize data structures?
Reply With Quote #5

Yeah I was referring to weapon slots. Guess I got to stare at the disassembly some more.
__________________
Spirit_12 is offline
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 15:38.


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