keybode

css v34 external entity list

Nov 23rd, 2014
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.63 KB | None | 0 0
  1. #include "EntityList.h"
  2. #include "Process.h"
  3. #include "HL2.h"
  4. #include "Engine.h"
  5.  
  6. CEntityList* g_pEntList = new CEntityList ();
  7.  
  8. CEntityList::CEntityList ( void )
  9. {
  10.     ZeroMemory(&m_LocalEntity, sizeof(CEntity) );
  11.     ZeroMemory(&m_EntityList, sizeof(CEntity) * 64 );
  12. }
  13.  
  14. CEntityList::~CEntityList ( void )
  15. {
  16.     ZeroMemory(&m_LocalEntity, sizeof(CEntity) );
  17.     ZeroMemory(&m_EntityList, sizeof(CEntity) * 64 );
  18. }
  19.  
  20. void CEntityList::Update ( void )
  21. {
  22.     base_entity_t Entity;
  23.  
  24.     byte Buffer[0x3000];
  25.  
  26.     int index = g_pEngine->GetLocalPlayer ();
  27.  
  28.     for ( int i = 1; i < 65; i++ )
  29.     {
  30.         if ( i == index )
  31.         {
  32.             hl2->ReadMemory ( hl2->m_client + HL2::m_EntityList + 40 + sizeof(base_entity_t) * i, &Entity, sizeof(base_entity_t) );
  33.  
  34.             if ( Entity.m_basePointer == 0 )
  35.                 m_LocalEntity.Invalidate ();
  36.             else
  37.             {
  38.                 hl2->ReadMemory ( Entity.m_basePointer - 8, Buffer, 0x3000 );
  39.                 m_LocalEntity.Update ( Entity.m_basePointer, i, Buffer );
  40.             }
  41.         }
  42.         else
  43.         {
  44.             hl2->ReadMemory ( hl2->m_client + HL2::m_EntityList + 40 + sizeof(base_entity_t) * i, &Entity, sizeof(base_entity_t) );
  45.  
  46.             if ( Entity.m_basePointer == 0 )
  47.                 m_EntityList[i].Invalidate ();
  48.             else
  49.             {
  50.                 hl2->ReadMemory ( Entity.m_basePointer - 8, Buffer, 0x3000 );
  51.                 m_EntityList[i].Update ( Entity.m_basePointer, i, Buffer );
  52.             }
  53.         }
  54.     }
  55. }
  56.  
  57. void CEntityList::Invalidate ( void )
  58. {
  59.     ZeroMemory(&m_LocalEntity, sizeof(CEntity) );
  60.     ZeroMemory(&m_EntityList, sizeof(CEntity) * 64 );
  61. }
  62.  
  63. CEntity* CEntityList::GetEntityByIndex ( int index )
  64. {
  65.     return &m_EntityList[index];
  66. }
  67.  
  68. CEntity* CEntityList::GetLocalEntity ( void )
  69. {
  70.     return &m_LocalEntity;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment