Unable to write table entity value

Please post any questions about developing your plugin here. Please use the search function before posting!
Tetragromaton
Junior Member
Posts: 20
Joined: Tue Mar 03, 2020 6:39 am

Unable to write table entity value

Postby Tetragromaton » Sat Mar 07, 2020 9:14 am

Hey guys, im on CSGO and i cant read/write the following property in my weapon entity. "m_szCustomName".
How can i read or write some of the data of the prop that is inside of the table like Table: m_Item (offset 60) (type DT_ScriptCreatedItem)
? thanks

Syntax: Select all

from players._base import *
from messages import SayText2
from messages import *
from commands.client import ClientCommand
from commands.typed import TypedServerCommand
from commands.typed import filter_str
from commands.say import SayCommand
from weapons.entity import Weapon
from weapons import *
from config.manager import ConfigManager


@ClientCommand('gg')
def ShowExceptionStreak(command_info, pindex):
client = Player(pindex)
gg = client.get_active_weapon().get_property_char("m_szCustomName")

SayText2(str(gg)).send(client.index)

Code: Select all

[SP] Caught an Exception:
Traceback (most recent call last):
  File "../addons/source-python/packages/source-python/commands/auth.py", line 44, in __call__
    return self.callback(*args)
  File "../addons/source-python/plugins/Something/Something.py", line 19, in ShowExceptionStreak
    gg = client.get_active_weapon().get_property_char("m_szCustomName")
  File "../addons/source-python/packages/source-python/entities/_base.py", line 565, in get_property_char
    return self._get_property(name, 'char')
  File "../addons/source-python/packages/source-python/entities/_base.py", line 615, in _get_property
    name, self.classname))

ValueError: Property "m_szCustomName" not found for entity type "weapon_g3sg1"
Last edited by L'In20Cible on Sat Mar 07, 2020 11:41 am, edited 1 time in total.
Reason: code → python
User avatar
L'In20Cible
Project Leader
Posts: 1533
Joined: Sat Jul 14, 2012 9:29 pm
Location: Québec

Re: Unable to write table entity value

Postby L'In20Cible » Sat Mar 07, 2020 11:48 am

If you use the following commands:

Code: Select all

sp dump server_classes classes;sp dump datamaps datamaps


It will generates a classes.txt and a datamaps.txt files into the ../logs/source-python/ directory. The classes are the properties that are networked, while the datamaps not necessarily. That one seems networked, and you will find it into the classes.txt file:

Syntax: Select all

CEconEntity -> CBaseFlex
DATATABLE m_AttributeManager (offset 1744) [4 properties]:
INT m_hOuter (offset 28 - 1772)
UCHAR m_ProviderType (offset 36 - 1780)
UCHAR m_iReapplyProvisionParity (offset 24 - 1768)
DATATABLE m_Item (offset 64 - 1808) [9 properties]:
INT m_iItemDefinitionIndex (offset 84 - 1892)
CHAR m_iEntityLevel (offset 92 - 1900)
INT m_iItemIDHigh (offset 104 - 1912)
INT m_iItemIDLow (offset 108 - 1916)
INT m_iAccountID (offset 112 - 1920)
CHAR m_iEntityQuality (offset 88 - 1896)
BOOL m_bInitialized (offset 124 - 1932)
STRING m_szCustomName (offset 184 - 1992)


Which means your path would be:

Syntax: Select all

custom_name = weapon.get_network_property_pointer('m_AttributeManager.m_Item.m_szCustomName') # Perhaps it is a _string_array instead of _string_pointer


Alternatively, you could dump the Entity.properties attributes:

Syntax: Select all

for property in entity.properties:
print(property)


PS: My dumps are most likely years old at this point, so that's possible you don't get the exact same content.

Return to “Plugin Development Support”

Who is online

Users browsing this forum: No registered users and 23 guests