summaryrefslogtreecommitdiff
path: root/src/cs2/hack.cpp
blob: c98337aa244abae9c176056f8c8a3bd9b90597e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#include "hack.h"
#include "entity.h"
#include "entity.h"
#include "iface.h"

SETTING_HOLDER gcfg;


PROCESS64* hack_init() {
  CS2* p = new CS2();
  if( !p->open() ) {
    delete p;
    return nullptr;
  }

  schema_dump_to_file( p );
  iface_dump_to_file( p );
  
  return p;
}

bool hack_run( PROCESS64* p ) {
  perf_run_metric( perf_loop_start );
  CS2* cs = (CS2*)p;

  for( I32 i = 0; i < 64; ++i ) {
    CS2_PLAYERCONTROLLER pc = cs2_ent_from_idx( cs, i );
    if( !pc )
      continue;

    CS2_PAWN pawn = pc.get_pawn();
    if( !pawn )
      continue;

    STR<128> name = pc.m_sSanitizedPlayerName();
    I32 health = pawn.m_iHealth();

    clog( "player %d [%llx]: %s, health %d\n", i, pc.ptr, name.data, health );
  }


  perf_run_metric( perf_loop_end );
  return true;
}