Ok, I found a working method after finding the netprop m_upgradeSlots for weapons. However, this indirectly gives them the attachments, and doesnt actually overwrite the attachments in their inventory, making it so that, despite having the weapons attached, it doesnt appear that way in the inventory screen.
However, I had it showing the gear correctly, so I looked more into that and found the table m_PlayerInventory under class CINSPlayer. Here, I found exactly what I need, but I am having trouble navigating the property tree and could use some help.
I can access the members of m_EquippedGear no problem:
Code:
int iGearOffs = GetEntSendPropOffs(client, "m_EquippedGear", true);
if(iGearOffs != -1)
{
for(int i = 0; i <= TOTAL_GEAR_SLOTS; i++)
{
a_iGearMembers[i] = GetEntData(client, iGearOffs + (4*i));
}
}
But given that "m_WeaponPurchases" has a table for each weapon, each of which has members and its own "m_hUpgrades" table, I'm having trouble figuring out how to get to the tables at the weapon level, and its m_hUpgrades table, since the names appear multiple times, and I am a bit confused how the offsets work with nested tables. I've searched all over the forums for examples with nested netprop tables, but couldnt find any. I also checked out
https://wiki.alliedmods.net/Entity_Properties , which several threads linked. I've also tried looking up navigating netprops and other related stuff.
Looking at the GetEnt* functions, I wondered if the "element" parameter would allow me to enumerate "m_WeaponPurchases" into each table. However, the ones I noticed with the element piece (GetEntProp, GetEntPropEnt) just return a value or ent index. I'm not sure if I'm supposed to just get the ent, then work off of its own class, and have concerns that doing that will land me back where I was with the inventory not being updated to reflect the changes.
I was also curious how GetEntDataArray works, and if that could help. In looking to test it to find out, I wasnt sure how to size it ("arraySize" param) when there are sub-tables...I first scripted:
Code:
int aaiWeapons[12];
iWeaponSlotOffs = FindSendPropInfo("m_PlayerInventory", "m_WeaponPurchases");
GetEntDataArray(client, iWeaponSlotOffs, aaiWeapons, 12);
But before testing realized that the array would contain the 12 tables (0 - 11), but wasnt sure how that would hold the sub-tables.
Any help would be appreciated. The concept behind how to do this goes past this plugin and would be useful for others as well.
__________________