SA-MP/saco/net/playerpool.h

52 lines
1.1 KiB
C
Raw Permalink Normal View History

2024-02-06 22:20:05 +08:00
#pragma once
#include <string>
2024-10-28 00:00:41 +08:00
#define INVALID_PLAYER_ID 0xFFFF
2024-02-06 22:20:05 +08:00
//----------------------------------------------------
class CPlayerPool
{
private:
2024-02-06 22:20:05 +08:00
int field_0;
PLAYERID m_LocalPlayerID;
2024-02-06 22:20:05 +08:00
std::string field_6;
int field_22;
CLocalPlayer *m_pLocalPlayer;
2024-02-06 22:20:05 +08:00
int field_2A[MAX_PLAYERS];
char _gapFDA[4016];
CNetPlayer *m_pPlayers[MAX_PLAYERS];
2024-02-06 22:20:05 +08:00
int field_2F3A;
public:
void SetLocalPlayerName(PCHAR szName) { field_6 = szName; };
PCHAR GetLocalPlayerName() { return (PCHAR)field_6.c_str(); };
void SetPlayerName(PLAYERID playerId, PCHAR szName) {
if(playerId > MAX_PLAYERS) return;
CNetPlayer* pPlayer = m_pPlayers[playerId];
if(!pPlayer) return;
pPlayer->m_PlayerName = szName;
}
CLocalPlayer * GetLocalPlayer() { return m_pLocalPlayer; };
CRemotePlayer* GetAt(PLAYERID playerId) {
if(playerId > MAX_PLAYERS) { return NULL; }
CNetPlayer *pNetPlayer = m_pPlayers[playerId];
if(pNetPlayer) return pNetPlayer->m_pRemotePlayer;
return NULL;
};
PLAYERID GetLocalPlayerID() { return m_LocalPlayerID; };
2024-02-06 22:20:05 +08:00
CPlayerPool();
};
//----------------------------------------------------