Raised This Month: $32 Target: $400
 8% 

ItemInfoArray


Post New Thread Reply   
 
Thread Tools Display Modes
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-19-2015 , 16:23   Re: ItemInfoArray
Reply With Quote #11

Ok, I picked up a GetItemFunction because the array it is used at it's beginning. Then, I made this:
Code:
[
	{
		"name"        : "ItemInfoArray",
		"library"     : "mod",
		"type"        : "byte",
		"memoryType"  : "data",
		"identifiers" : 
		[
			{
				"os"    : "windows",
				"mod"   : "cstrike",
				"value" : [0x8B,0x41,0x04,0x56,0x8B,0x10,0xA1,"*","*","*","*",0x8B,0xB0,0x98,0x00,0x00,0x00,0x8B,0x44,0x24,0x08,0x03,0xD6,0x5E,0x89,0x50,0x18,0x33,0xD2,0x89,0x50,0x10,0x89,0x10,0x89,0x50,0x24,0xBA,0x1C,0x00,0x00,0x00],
				"displacement" : 6
			},
			{
				"os"    : "linux",
				"mod"   : "cstrike",
				"value" : "_ZN15CBasePlayerItem13ItemInfoArrayE"
			}
		]
	}
]
Ignore the bad signature, used makesig.idc to get it because I was rushing to test, it's good for testing because it is found and referenced one time.
Now, the thing is, I have no ideea how to get the values as game does. The array is indexed like ItemInfoArray[ m_iId ].iFlag. How could I acces it like that(given that I have the CSW_ id) ?

I need to get the iFlag value in my function so I can check for ITEM_FLAG_EXHAUSTIBLE
__________________

Last edited by HamletEagle; 08-19-2015 at 16:25.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-19-2015 , 17:33   Re: ItemInfoArray
Reply With Quote #12

Maybe like: address + member_offset + array_index * sizeof(structure)
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-20-2015 , 03:54   Re: ItemInfoArray
Reply With Quote #13

So it should be like OrpheuMemoryGet("ItemInfoArray") + 9 + CSW_AK47 * 152 ? 9 is the position of the iFlags in the enum, 152 is the size of the struct(I don't know how to get it directly, so I did like 8 ints * 16 + 3 char * 8 ) ? It doesn't seem to work. Ah, I'm confused.
__________________

Last edited by HamletEagle; 08-20-2015 at 03:54.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2015 , 04:33   Re: ItemInfoArray
Reply With Quote #14

member_offset is the location of the member from a base address. You have to take in account the size of the type of each member.

int = 4 bytes
pointer = 4 bytes

So, iFlags offset is 36.
Since all members are 4 bytes, you can also say that to go to iFlags you have before 9 members of size 4, 9 * 4 = 36.

The size of structure is also wrong. You have 11 members of size 4, size of structure is then 44.

Code:
          level 0                         level 1  
      
    iSlot iPosition pszAmmo1 ...    iSlot iPosition pszAmmo1 ...
   |-     -         -        ...    -     -         -        ...   
Base          v                               v
           44 bytes                        44 bytes
Well you have to imagine the array on one line. To know a member position, like pszAmmo1, you see it's at 4 + 4 bytes from the start.
To go to level 1, from pszAmmo1, you know the structure size is 44, so you do 1 * 44.
__________________

Last edited by Arkshine; 08-20-2015 at 04:42.
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-20-2015 , 05:03   Re: ItemInfoArray
Reply With Quote #15

Ok, this make sense. I still can't figure out how to use OrpheuMemory get on it. I've done like: OrpheuMemoryGet("ItemInfoArray") + 36 + CSW_AK47 * 44. The thing is that it returns a huge number when it should be 0(ak47 has no flags p->iFlags = 0;). Or maybe my signature is wrong and does not point to the array, idk.
__________________

Last edited by HamletEagle; 08-20-2015 at 05:05.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2015 , 05:08   Re: ItemInfoArray
Reply With Quote #16

Well, of course, you're working from a base address. What you get is the address where value is hold.
So you need to use OrpheuMemoryGet() at this address you found, to read the value in memory.
__________________
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-20-2015 , 05:16   Re: ItemInfoArray
Reply With Quote #17

OrpheuMemoryGet expect a string as first param(the file from memory folder), so I can't simply do like:
PHP Code:
OrpheuMemoryGet(OrpheuMemoryGet("ItemInfoArray") + 36 CSW_AK47 44
__________________
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2015 , 05:35   Re: ItemInfoArray
Reply With Quote #18

Well, yes, you need some config file in memory/ directory to read a int.

Then OrpheuMemoryGetAtAddress(OrpheuMemoryGet("Ite mInfoArray") + 36 + CSW_AK47 * 44), "int")
__________________

Last edited by Arkshine; 08-20-2015 at 05:39.
Arkshine is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 08-20-2015 , 06:02   Re: ItemInfoArray
Reply With Quote #19

Ok, I have created a file like:
Code:
{
    "name"        : "int",
    "library"     : "mod",
    "type"        : "int",
    "memoryType"  : "data",
    "identifiers" :
    [
        {
            "os"    : "windows",
            "mod"   : "cstrike",
            "value" : 0
        },
        {
            "os"    : "linux",
            "mod"   : "cstrike",
            "value" : 0
        }
    ]
}
Then:
Code:
OrpheuMemoryGetAtAddress(OrpheuMemoryGet("ItemInfoArray") + 36 + CSW_AK47 * 44, "int")
Now, I face this error:
Code:
 [ORPHEU] Address isn't contained in the library
This means that the signature is wrong, no ?
__________________

Last edited by HamletEagle; 08-20-2015 at 06:05.
HamletEagle is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 08-20-2015 , 06:31   Re: ItemInfoArray
Reply With Quote #20

ItemInfoArray is not used in GetItemInfo. Not sure where you did see that.
__________________
Arkshine is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 18:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode