[CS:S] m_flStamina not found

Please post any questions about developing your plugin here. Please use the search function before posting!
Jake
Junior Member
Posts: 19
Joined: Sun Oct 04, 2015 7:54 pm

[CS:S] m_flStamina not found

Postby Jake » Wed Jun 29, 2016 5:25 am

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?
User avatar
Ayuto
Project Leader
Posts: 2195
Joined: Sat Jul 07, 2012 8:17 am
Location: Germany

Re: [CS:S] m_flStamina not found

Postby Ayuto » Wed Jun 29, 2016 5:50 am

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.
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: [CS:S] m_flStamina not found

Postby L'In20Cible » Wed Jun 29, 2016 5:07 pm

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.
Jake
Junior Member
Posts: 19
Joined: Sun Oct 04, 2015 7:54 pm

Re: [CS:S] m_flStamina not found

Postby Jake » Sat Jul 02, 2016 10:30 pm

That's good to know, thanks again

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 108 guests