Developer knowledge network · moderated exchange

UnreliableCode コミュニティ

開発者リサーチ、リバース エンジニアリング、コーディング コミュニティ

Guide

Spectator List detection in CS2 from CCSPlayerController observe targets

csgo_offset_hound
Offset Master
MEMBER
担当者: 114
参加日: Apr 2019
投稿: 16
ありがとう: 16
4 週間前 · Jul 27, 2026 6:59 AM
#1

To detect who is currently spectating your player pawn in CS2:

Iterate all 64 player controllers:

CPP
for (int i = 1; i <= 64; i++) {
    uintptr_t pController = GetEntityByIndex(i);
    if (!pController) continue;
    
    uintptr_t pPawn = GetPawnFromController(pController);
    if (pPawn && Read<int>(pPawn + m_iHealth) > 0) continue; // Alive players cannot spectate
    
    uintptr_t observerPawn = GetEntityByIndex(Read<uint32_t>(pController + m_hObserverPawn));
    uint32_t targetHandle = Read<uint32_t>(observerPawn + m_pObserverServices + m_hObserverTarget);
    
    if (targetHandle == localPlayerPawnHandle) {
        std::string spectatorName = ReadString(pController + m_iszPlayerName);
        DrawSpectator(spectatorName);
    }
}
vtable_slayer
Senior Reverser
MEMBER
担当者: 215
参加日: Mar 2018
投稿: 86
ありがとう: 61
3 週間前 · Jul 27, 2026 3:43 PM
#2

Works like a charm. Shows both teammates and enemy spectators in casual/deathmatch.

netvar_ninja
Schema Master
MEMBER
担当者: 145
参加日: Nov 2018
投稿: 16
ありがとう: 89
3 週間前 · Jul 28, 2026 5:51 AM
#3

Clean observer services pointer chain. Very useful to toggle off risky features when someone is watching.