The signature is correct. What is not correct is the data type for ItemArrayInfo. You want to retrieve an address, so it should be "pointer" or "int".
Now you have a valid address, and you have figured out that the address doesn't start at the beginning of structure, you can dump the array.
Note: you need a similar file as "int" but for "string".
PHP Code:
new baseAddress = OrpheuMemoryGet("ItemInfoArray") - (is_linux_server() ? 0 : 24); // Not totally sure why, likely it's the address of .pszName. Don't know if the same for linux, looks like not.
const structureSize = 44;
const arrayElements = 32;
const memberSize = 4;
const membersCount = structureSize / memberSize;
const arraySize = arrayElements * structureSize;
enum ItemInfo
{
IISlot, IIPosition, IIAmmo1, IIMaxAmmo1, IIAmmo2, IIMaxAmmo2, IIName, IIMaxClip, IIId, IIFlags, IIWeight
};
new const ItemInfoIdentifiers[ItemInfo][] =
{
"slot", "position", "ammo1", "maxammo1", "ammo2", "maxammo2", "name", "maxclip", "id", "flags", "weight"
};
new buffer[32];
new value;
for (new element = 0; element < arrayElements; ++element)
{
if (element == 0 || element == 2 || element == 31)
{
continue;
}
server_print("Weapon ID %d", element);
for (new ItemInfo:member; member < membersCount; ++member)
{
value = OrpheuMemoryGetAtAddress(baseAddress + (element * structureSize) + (any:member * memberSize), "int");
switch (member)
{
case IIAmmo1, IIAmmo2, IIName:
{
value && OrpheuMemoryGetAtAddress(value, "string", buffer, charsmax(buffer));
server_print(" %16s ^"%s^"", ItemInfoIdentifiers[member], buffer);
}
default:
{
server_print(" %16s %d", ItemInfoIdentifiers[member], value);
}
}
}
}
Feel free to adapt code now if you want to retrieve just a specific member.
__________________