[server] Implement and match n_IsPlayerNPC(...)

This commit is contained in:
RD42 2024-04-27 18:17:22 +08:00
parent 8283f96357
commit fdd891098b
2 changed files with 18 additions and 2 deletions

View File

@ -62,6 +62,8 @@ public:
BOOL IsAdmin(PLAYERID playerId) { return m_bIsAnAdmin[playerId]; };
BOOL IsNPC(PLAYERID playerId) { return m_bIsAnNPC[playerId]; };
};
#endif

View File

@ -397,10 +397,24 @@ static cell AMX_NATIVE_CALL n_ConnectNPC(AMX *amx, cell *params)
return 0;
}
// native IsPlayerNPC(playerid)
static cell AMX_NATIVE_CALL n_IsPlayerNPC(AMX *amx, cell *params)
{
// TODO: IsPlayerNPC
return 0;
BOOL bResult = FALSE;
if(pNetGame)
{
CPlayerPool* pPlayerPool = pNetGame->GetPlayerPool();
if(pPlayerPool && pPlayerPool->GetSlotState((PLAYERID)params[1]))
{
if(pPlayerPool->IsNPC((PLAYERID)params[1]))
{
bResult = TRUE;
}
}
}
return bResult;
}
static cell AMX_NATIVE_CALL n_Create3DTextLabel(AMX *amx, cell *params)