Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "CRadar.h"
- using namespace MemUtils;
- namespace Hack
- {
- CRadar::CRadar( CSigInfo sigInfo )
- {
- try
- {
- CSigScanner sigScanner( sigInfo );
- m_ProcTools = CProcTools( );
- if( sigScanner.FindNext( ) )
- {
- this->m_pRadarBaseOffset = sigScanner.GetFullAddress< DWORD >( );
- }
- else
- {
- throw std::exception( "Could not find radar base offset!" );
- }
- }
- catch( std::exception &e )
- {
- this->m_pRadarBaseOffset = nullptr;
- Warning( e.what( ) );
- return;
- }
- }
- BYTE* CRadar::BuildAddressByID( int playerID, int propOffset )
- {
- return (BYTE*)( (DWORD)this->m_pRadarBaseOffset + propOffset + 0x140 * playerID );
- }
- int CRadar::GetPlayerHealth( int id )
- {
- IClientEntity* pClientEntity = GlobIfaces::g_pClientEntityList->GetClientEntity( id );
- BYTE* pbAddress = nullptr;
- if( pClientEntity->IsDormant( ) )
- {
- C_BaseEntity* pBaseEntity = pClientEntity->GetBaseEntity( );
- DWORD dwOffset = CClientOffsets::GetOffset( "CBaseEntity", "m_iHealth" );
- pbAddress = (BYTE*)( (DWORD)pBaseEntity + dwOffset );
- return m_ProcTools.ReadInt( pbAddress );
- }
- else
- {
- pbAddress = this->BuildAddressByID( id, HEALTH_OFFSET );
- return m_ProcTools.ReadInt( pbAddress );
- }
- }
- Vector CRadar::GetPlayerOrigin( int id )
- {
- IClientEntity* pClientEntity = GlobIfaces::g_pClientEntityList->GetClientEntity( id );
- BYTE* pbAddress = nullptr;
- if( pClientEntity->IsDormant( ) )
- {
- C_BaseEntity* pBaseEntity = pClientEntity->GetBaseEntity( );
- DWORD dwOffset = CClientOffsets::GetOffset( "CBaseEntity", "m_vecOrigin" );
- pbAddress = (BYTE*)( (DWORD)pBaseEntity + dwOffset );
- return m_ProcTools.ReadData< Vector >( pbAddress );
- }
- else
- {
- pbAddress = this->BuildAddressByID( id, ORIGIN_OFFSET );
- return m_ProcTools.ReadData< Vector >( pbAddress );
- }
- }
- QAngle CRadar::GetPlayerAngles( int id )
- {
- IClientEntity* pClientEntity = GlobIfaces::g_pClientEntityList->GetClientEntity( id );
- BYTE* pbAddress = nullptr;
- if( pClientEntity->IsDormant( ) )
- {
- C_BaseEntity* pBaseEntity = pClientEntity->GetBaseEntity( );
- DWORD dwOffset = CClientOffsets::GetOffset( "CBaseEntity", "m_angRotation" );
- pbAddress = (BYTE*)( (DWORD)pBaseEntity + dwOffset );
- return m_ProcTools.ReadData< QAngle >( pbAddress );
- }
- else
- {
- pbAddress = this->BuildAddressByID( id, ANGLES_OFFSET );
- return m_ProcTools.ReadData< QAngle >( pbAddress );
- }
- }
- string CRadar::GetPlayerName( int id )
- {
- BYTE* pbAddress = nullptr;
- pbAddress = this->BuildAddressByID( id, NAME_OFFSET );
- return m_ProcTools.ReadString( pbAddress, 32 );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment