2023-10-29 22:26:43 +08:00
|
|
|
|
|
|
|
#ifndef SAMPSRV_PLAYERPOOL_H
|
|
|
|
#define SAMPSRV_PLAYERPOOL_H
|
|
|
|
|
2024-10-27 22:39:37 +08:00
|
|
|
#define INVALID_PLAYER_ID 0xFFFF
|
|
|
|
|
2023-10-29 22:26:43 +08:00
|
|
|
class CPlayerPool // size: WL 199024
|
|
|
|
{
|
|
|
|
private:
|
2023-11-22 23:38:00 +08:00
|
|
|
|
|
|
|
int m_iVirtualWorld[MAX_PLAYERS];
|
|
|
|
int field_FA0;
|
|
|
|
int field_FA4;
|
|
|
|
int field_FA8;
|
|
|
|
int m_iPlayerScore[MAX_PLAYERS];
|
|
|
|
int m_iPlayerMoney[MAX_PLAYERS];
|
2024-04-11 22:47:05 +08:00
|
|
|
int m_iPlayerDrunkLevel[MAX_PLAYERS];
|
2023-11-22 23:38:00 +08:00
|
|
|
DWORD field_3E8C[1000];
|
2024-04-11 22:47:05 +08:00
|
|
|
CHAR m_szPlayerClientID[MAX_PLAYERS][101];
|
|
|
|
CHAR m_szPlayerVersion[MAX_PLAYERS][25];
|
|
|
|
int field_23A5C[MAX_PLAYERS];
|
2023-11-22 23:38:00 +08:00
|
|
|
BOOL m_bPlayerSlotState[MAX_PLAYERS];
|
2024-04-11 22:47:05 +08:00
|
|
|
CPlayer *m_pPlayers[MAX_PLAYERS];
|
|
|
|
CHAR m_szPlayerName[MAX_PLAYERS][MAX_PLAYER_NAME+1];
|
|
|
|
BOOL m_bIsAnAdmin[MAX_PLAYERS];
|
|
|
|
BOOL m_bIsAnNPC[MAX_PLAYERS];
|
|
|
|
|
2024-04-27 18:16:08 +08:00
|
|
|
char _gap2EA24[8000];
|
2024-04-11 22:47:05 +08:00
|
|
|
|
2023-11-22 23:38:00 +08:00
|
|
|
int field_30964;
|
2024-04-27 18:18:23 +08:00
|
|
|
int m_iPoolSize;
|
2023-11-22 23:38:00 +08:00
|
|
|
int field_3096C;
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
CPlayerPool();
|
2023-12-13 23:58:15 +08:00
|
|
|
~CPlayerPool();
|
|
|
|
|
|
|
|
BOOL Delete(PLAYERID playerId, BYTE byteReason);
|
2023-11-22 23:38:00 +08:00
|
|
|
|
2024-04-12 22:00:55 +08:00
|
|
|
// Retrieve a player
|
|
|
|
CPlayer* GetAt(PLAYERID playerId) {
|
|
|
|
if (playerId >= MAX_PLAYERS) { return NULL; }
|
|
|
|
return m_pPlayers[playerId];
|
|
|
|
};
|
|
|
|
|
|
|
|
// Find out if the slot is inuse.
|
|
|
|
BOOL GetSlotState(PLAYERID playerId) {
|
|
|
|
if(playerId >= MAX_PLAYERS) { return FALSE; }
|
|
|
|
return m_bPlayerSlotState[playerId];
|
|
|
|
};
|
|
|
|
|
2024-09-18 23:39:33 +08:00
|
|
|
PCHAR GetPlayerName(PLAYERID playerId) {
|
|
|
|
if(playerId >= MAX_PLAYERS) { return NULL; }
|
|
|
|
return m_szPlayerName[playerId];
|
|
|
|
};
|
|
|
|
|
2024-04-28 22:32:25 +08:00
|
|
|
PCHAR GetPlayerClientID(PLAYERID playerId) {
|
|
|
|
if(playerId >= MAX_PLAYERS) { return NULL; }
|
|
|
|
return m_szPlayerClientID[playerId];
|
|
|
|
};
|
|
|
|
|
2024-01-25 22:15:40 +08:00
|
|
|
void ResetPlayerScoresAndMoney() {
|
|
|
|
memset(&m_iPlayerScore[0],0,sizeof(int) * MAX_PLAYERS);
|
|
|
|
memset(&m_iPlayerMoney[0],0,sizeof(int) * MAX_PLAYERS);
|
|
|
|
memset(&m_iVirtualWorld[0],0,sizeof(int) * MAX_PLAYERS);
|
2024-04-27 18:16:08 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
BOOL IsAdmin(PLAYERID playerId) { return m_bIsAnAdmin[playerId]; };
|
|
|
|
|
2024-04-27 18:17:22 +08:00
|
|
|
BOOL IsNPC(PLAYERID playerId) { return m_bIsAnNPC[playerId]; };
|
|
|
|
|
2024-04-27 18:18:23 +08:00
|
|
|
int GetPoolSize() { return m_iPoolSize; };
|
2023-10-29 22:26:43 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|