viscount1x
Platinian
Does anyone know player class for counterflame hooking class PlayerController update method only gives local player
HOOK ADDRESSES (offsets inside libil2cpp.so, game version 1.4)
--------------------------------------------------------------
Method Address Notes
PlayerNetwork::Update 0x28f4928 Runs for every player. Your main hook.
PlayerNetwork::OnPhotonSerializeView 0x28f66f4 Runs when position updates arrive over the network
PlayerNetwork::TryGetPosition 0x28f5da0 Gets a remote player's position
PlayerNetwork::Awake 0x28f4750 Use to collect each player into your own list
PlayerNetwork::Start 0x28f47b4 Use to collect each player into your own list
PlayerController::Update 0x28fccd4 The one you have now (local player only)
PlayerController::TakeDamage 0x28fd1e4
PlayerController::Die 0x290021c
BotController::Start 0x278c060 Bots, which are likely your opponents offline
BotController::TakeDamage 0x278c100
BotController::Respawn 0x278c328
FIELD OFFSETS (read from the getter code)
-----------------------------------------
PlayerController:
+0x80 the network view (get_Photon)
+0x90 the player record (get_Player)
+0xa8 a byte flag for "is dead" (get_IsDeath)
BotController:
+0x18 health (an int)
The player record (Photon.Realtime.Player):
Carries get_Health, get_IsAlive, get_Team, get_NickName, get_Kills and get_Money.
You can call those getters on the object at PlayerController +0x90.
The owner of the thread decides if this solved his problem/question@DaRealPanDa solved
The owner of the thread decides if this solved his problem/question
@viscount1x if so, please mark above's post as solution
Yes. You don't need OnDestroy on PlayerNetwork. Two ways, and I'd use both.@Wxrnin is there any way to clear player list i can only hook PlayerNetwork::Update to get player there's no OnDestroy or OnDisable to hook i can only clear player list a ImGui checbox manually evrytime when match end otherwise it keep reading and crash
#include <unordered_map>
#include <mutex>
#include <chrono>
struct PlayerEntry { void* net; int64_t lastSeenMs; };
static std::unordered_map<void*, PlayerEntry> g_players;
static std::mutex g_playersMtx;
static int64_t NowMs() {
using namespace std::chrono;
return duration_cast<milliseconds>(steady_clock::now().time_since_epoch()).count();
}
// PlayerNetwork::Update (libil2cpp.so + 0x28f4928)
void (*old_PlayerNetwork_Update)(void* self);
void hk_PlayerNetwork_Update(void* self) {
old_PlayerNetwork_Update(self);
if (!self) return;
std::lock_guard<std::mutex> lk(g_playersMtx);
g_players[self] = { self, NowMs() }; // add or refresh
}
// Call at the top of your ImGui / ESP draw, before you read any player
void PrunePlayers() {
const int64_t now = NowMs();
std::lock_guard<std::mutex> lk(g_playersMtx);
for (auto it = g_players.begin(); it != g_players.end(); ) {
if (now - it->second.lastSeenMs > 300) it = g_players.erase(it);
else ++it;
}
}
PrunePlayers();
std::vector<void*> snapshot;
{
std::lock_guard<std::mutex> lk(g_playersMtx);
for (auto& [k, e] : g_players) snapshot.push_back(e.net);
}
for (void* net : snapshot) { /* read position etc. */ }
PlayerController::OnDestroy 0x28fce00 Clear g_players
GameHelper::OnLeftRoom 0x2aeb884 Clear g_players (fires when you leave a match or room)
void (*old_PC_OnDestroy)(void* self);
void hk_PC_OnDestroy(void* self) {
{ std::lock_guard<std::mutex> lk(g_playersMtx); g_players.clear(); }
old_PC_OnDestroy(self);
}
void (*old_GH_OnLeftRoom)(void* self);
void hk_GH_OnLeftRoom(void* self) {
{ std::lock_guard<std::mutex> lk(g_playersMtx); g_players.clear(); }
old_GH_OnLeftRoom(self);
}