Accessing Sub-Properties

General discussion for off-topic subjects.
User avatar
Senior Member
Posts: 130
Joined: Tue Jan 26, 2016 1:24 pm
Location: Switzerland

Accessing Sub-Properties

Postby D3CEPTION » Wed Apr 27, 2016 4:25 am

Code: Select all

CBasePlayer 65535 [33 properties]:
        datatable baseclass (offset 0)
        datatable pl (offset 2960)  [1 properties]:
                int deadflag (offset 4)
        int m_afPhysicsFlags (offset 3132)
        int m_hVehicle (offset 3136)
        int m_hUseEntity (offset 3120)
        int m_hGroundEntity (offset 348)
        int m_iHealth (offset 532)
        int m_lifeState (offset 557)
        datatable m_iAmmo (offset 1840)  [32 properties]:
                int 000 (offset 0)
                int 001 (offset 4)
                int 002 (offset 8)
                int 003 (offset 12)

i got this dump from a post by satoon .
and am now wondering how to access the datatable "m_iAmmo" or any of its offsets from the server? in satoons post it says "Entity.DumpServerClasses", but could it be that the entire dump contains merely clientsideproperties, that the server received a copy from (@engine compile) but mostly doesnt even have access too now @runtime, in terms of changing data?

how do i get my "CBasePlayer" object from the server anyway? i dont think using a normal player object and "get_property" "m_iAmmo" is the right approach ..
User avatar
Project Leader
Posts: 2384
Joined: Sat Jul 07, 2012 1:59 am

Re: Accessing Sub-Properties

Postby satoon101 » Wed Apr 27, 2016 5:12 am

That is actually correct for CS:GO. For CS:S, it's localdata.m_iAmmo. You have to use the full path except for the classname in the get/set_property_<type> call. Though, that specific property is already stored in our weapon data: ... on/weapons

Just open any of the game files up, and you will see ammoprop under the properties section. So, for instance, if you want to access m_iAmmo.000 in CS:GO, you would simply use:

Code: Select all


Or, to make your plugin usable on multiple games, you could use that ammoprop value:

Code: Select all

player.get_property_int(weapon_manager.ammoprop + '000')

However, if you know the weapon you want to get/set the ammo for, you are much better off using the Player.get/set_ammo methods.

Actually, come to think of it, those properties only work for projectile weapons now in CS:GO. We have an issue to work on that, but it hasn't been fixed quite yet: ... /issues/50

Return to “Whatever”

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest