QuestionGetMyIndex help

Posts 1–3 of 3 · Page 1 of 1
GetMyIndex help
Code:
char GetMyIndex (DWORD pLTCLientShell) 
{
    if (pLTCLientShell)
    {
        BYTE clients = *(BYTE*)(pLTCLientShell + dwCPlayerStart);  // 1.OK!
        if (clients < 16)
            return *(char*)(pLTCLientShell + clients * dwCPlayerSize + MEOffset);  // 2.Why???
    }
    return -1;
}
CLTClientShell::GetMeIdxInPlayerInfoList

CEngine.h:
Code:
...
#define P_GETMEIDXINPLAYERINFOLIST  "\x56\x8B\xF1\x0F\xB6\x86\x00\x00\x00\x00\x50\xE8\x00\x00\x00\x00"
#define M_GETMEIDXINPLAYERINFOLIST  "xxxxxx??xxxx????"

#define P_ILTCLIENTSHELL            "\x8B\x0D\x00\x00\x00\x00\x8B\x42\x1C\xFF\xD0\x68"
#define M_ILTCLIENTSHELL            "xx????xxxxxx"
...
 
...
typedef int ( __thiscall *GetMeIdxInPlayerInfoList_t )( CILTClientShell* );
extern GetMeIdxInPlayerInfoList_t GetMeIdxInPlayerInfoList;
...

class CEngine
{
public:
   ...
    struct address_t
    {
        ...
        DWORD ILTClientShell;

        DWORD GetMeIdxInPlayerInfoList;
        ...
    }m_Addr;

    struct interface_t
    {
        ...
        CILTClientShell* ILTClientShell;
        ...
    }m_Interface;
   ...
}
CEngine.cpp:
Code:
...
GetMeIdxInPlayerInfoList_t GetMeIdxInPlayerInfoList;
...


void CEngine::PatternHunt( )
{
    ...
    m_Addr.ILTClientShell = PatternScan(
	m_Addr.CFBase,
	0x7FFFFFFF,
	reinterpret_cast< PBYTE >( P_ILTCLIENTSHELL ),
	reinterpret_cast< PCHAR >( M_ILTCLIENTSHELL )
	);

    if( m_Addr.ILTClientShell )
    {
	m_Addr.ILTClientShell = *reinterpret_cast< PDWORD >(
		m_Addr.ILTClientShell + 2 );
    }

    m_Addr.GetMeIdxInPlayerInfoList = PatternScan(
        m_Addr.CShell,
        0x7FFFFFFF,
        reinterpret_cast< PBYTE >( P_GETMEIDXINPLAYERINFOLIST ),
        reinterpret_cast< PCHAR >( M_GETMEIDXINPLAYERINFOLIST )
    );
    ...
}


bool CEngine::Init( )
{
    ...
    m_Interface.ILTClientShell = *reinterpret_cast< CILTClientShell** >(
        m_Addr.ILTClientShell );

    if( m_Interface.ILTClientShell )
    {
        GetMeIdxInPlayerInfoList = reinterpret_cast< GetMeIdxInPlayerInfoList_t >(
            m_Addr.GetMeIdxInPlayerInfoList );
    }
    ...
}


CPlayer* CEngine::GetPlayerByIndex( int Index )
{
    return( reinterpret_cast< CPlayer* >( ( (
	m_Interface.ILTClientShell + ( m_Offset.PlayerSize + 4 ) ) + ( Index * m_Offset.PlayerStructSize ) ) ) );
}


CPlayer* CEngine::GetLocalPlayer( )
{
    return( reinterpret_cast< CPlayer* >( ( (
	m_Interface.ILTClientShell + ( m_Offset.PlayerSize + 4 ) ) + ( GetMeIdxInPlayerInfoList( m_Interface.ILTClientShell ) * m_Offset.PlayerStructSize ) ) ) );
}
China version's LocalIndex pointer is not always valid i've found that long time ago.
Posts 1–3 of 3 · Page 1 of 1
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?