[server] Implement/match n_GetPlayerName(...)

This commit is contained in:
RD42
2024-09-18 23:39:33 +08:00
parent f74fc485c4
commit d60dc61013
2 changed files with 10 additions and 2 deletions

View File

@ -48,6 +48,11 @@ public:
return m_bPlayerSlotState[playerId]; return m_bPlayerSlotState[playerId];
}; };
PCHAR GetPlayerName(PLAYERID playerId) {
if(playerId >= MAX_PLAYERS) { return NULL; }
return m_szPlayerName[playerId];
};
PCHAR GetPlayerClientID(PLAYERID playerId) { PCHAR GetPlayerClientID(PLAYERID playerId) {
if(playerId >= MAX_PLAYERS) { return NULL; } if(playerId >= MAX_PLAYERS) { return NULL; }
return m_szPlayerClientID[playerId]; return m_szPlayerClientID[playerId];

View File

@ -1009,10 +1009,13 @@ static cell AMX_NATIVE_CALL n_IsPlayerInAnyVehicle(AMX *amx, cell *params)
return 0; return 0;
} }
// native GetPlayerName(playerid, const name[], len)
static cell AMX_NATIVE_CALL n_GetPlayerName(AMX *amx, cell *params) static cell AMX_NATIVE_CALL n_GetPlayerName(AMX *amx, cell *params)
{ {
// TODO: GetPlayerName PLAYERID playerId = (PLAYERID)params[1];
return 0; if (playerId > MAX_PLAYERS || !pNetGame->GetPlayerPool()->GetSlotState(playerId)) return 0;
return set_amxstring(amx, params[2], pNetGame->GetPlayerPool()->
GetPlayerName(playerId), params[3]);
} }
static cell AMX_NATIVE_CALL n_SetPlayerCheckpoint(AMX *amx, cell *params) static cell AMX_NATIVE_CALL n_SetPlayerCheckpoint(AMX *amx, cell *params)