Page 1 of 1

[CS:S] m_flStamina not found

Posted: Wed Jun 29, 2016 5:25 am
by Jake
Player().get_property_float/set_property_float is giving me

Code: Select all

ValueError: Property 'm_flStamina' not found for entity type 'player'


Is there another way I should get to m_flStamina?

Re: [CS:S] m_flStamina not found

Posted: Wed Jun 29, 2016 5:50 am
by Ayuto
You need to use the full property path. However, stamina is already a built-in property:
https://github.com/Source-Python-Dev-Te ... er.ini#L72

So, you can just do player.stamina.

Re: [CS:S] m_flStamina not found

Posted: Wed Jun 29, 2016 5:07 pm
by L'In20Cible
To get a list of networkable properties for a specific game, run the following command:

Code: Select all

sp dump server_classes <file name>


And a list of non-networkable ones with the following command:

Code: Select all

sp dump datamaps <file name>


Both will creates a file in the .../logs/source-python/ directory. For example, here is the result of the first command on a CS:S server:



As you can see, in the CCSPlayer class (line 1813), m_flStamina (line 1826) is embedded in the cslocaldata table (line 1825) hence why you need to use cslocaldata.m_flStamina to access it. Originally, we were not requiring the table name to be passed but then realized that nothing dictate that a table is not using the same property name as another so passing the full path seemed to be the only way to enforce the right offset to be read/set.

Re: [CS:S] m_flStamina not found

Posted: Sat Jul 02, 2016 10:30 pm
by Jake
That's good to know, thanks again