// Вначале получаем указатель на структуру SAMP или stSAMP, CNetGame, pSAMP, вообщем как удобнее
pSAMP = *reinterpret_cast<void **>( samp.dll + 0x21A0F8 );
// Потом из структуры сампа получаем указатель на структуру игровых пулов
ppPools = reinterpret_cast<void **>( (size_t)pSAMP + 0x3CD );
// Потом из структуры игровых пулов в структуре самп получаем указатель на структуру игроков
ppPlayer = reinterpret_cast<void**>( (size_t)pPools + 0x18 );
// В итоге, из структуры игроков получаем ник и ид ЛОКАЛЬНОГО игрока. Смотри: https://gitlab.com/prime-hack/samp/plugins/templates/samp/-/blob/master/SAMP by SR_team
pLocalPlayerNickname = reinterpret_cast<void*>( (size_t)pPlayerPool + 0xA );
pLocalPlayerId = reinterpret_cast<short*>( (size_t)pPlayerPool + 0x4 );
short SAMP::PlayerPool::GetLocalPlayerId() {
if (pLocalPlayerId) return *pLocalPlayerId;
return -1;
}
std::string SAMP::PlayerPool::GetLocalPlayerNickname() {
struct msvc_string {
union {
char szString[0x10];
char* pszString;
};
std::size_t length;
std::size_t allocated;
};
auto string = *reinterpret_cast<msvc_string*>(pLocalPlayerNickname);
if (string.allocated < 0x10) return { string.szString, string.length };
return { string.pszString, string.length };
}