From 36792cec632df27bba68283cdbf2c0ea6c724955 Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Sat, 8 Jun 2024 21:52:14 +0800 Subject: [PATCH] [bot] Implement `n_IsPlayerStreamedIn(...)` --- bot/net/netgame.cpp | 9 +++++++++ bot/net/netgame.h | 1 + bot/scrcustom.cpp | 5 +++-- 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bot/net/netgame.cpp b/bot/net/netgame.cpp index 464b61b..31ebfff 100644 --- a/bot/net/netgame.cpp +++ b/bot/net/netgame.cpp @@ -46,6 +46,15 @@ BYTE byteMySeatID; bool bSpawned = false; +//---------------------------------------------------- +// MATCH +BOOL CNetGame::IsPlayerAdded(PLAYERID playerId) +{ + if(playerId >= MAX_PLAYERS) return FALSE; + + return bPlayerSlotState[playerId] != FALSE; +} + //---------------------------------------------------- // MATCH void CNetGame::SetMyZAngle(float fAngle) diff --git a/bot/net/netgame.h b/bot/net/netgame.h index d7760bc..aa8af80 100644 --- a/bot/net/netgame.h +++ b/bot/net/netgame.h @@ -96,6 +96,7 @@ public: void ShutdownForGameModeRestart(); void sub_415EC0(VEHICLEID VehicleID, BOOL a2); + BOOL IsPlayerAdded(PLAYERID playerId); void SetMyZAngle(float fAngle); void SetPlayerAdded(PLAYERID playerId, BOOL a2); diff --git a/bot/scrcustom.cpp b/bot/scrcustom.cpp index f50d9dc..ee7532f 100644 --- a/bot/scrcustom.cpp +++ b/bot/scrcustom.cpp @@ -178,8 +178,9 @@ static cell AMX_NATIVE_CALL n_GetPlayerSpecialAction(AMX *amx, cell *params) // native IsPlayerStreamedIn(playerid) static cell AMX_NATIVE_CALL n_IsPlayerStreamedIn(AMX *amx, cell *params) { - // TODO: n_IsPlayerStreamedIn - return 0; + if(!pNetGame->GetPlayerPool()->GetSlotState((PLAYERID)params[1])) return 0; + + return pNetGame->IsPlayerAdded((PLAYERID)params[1]); } // native IsVehicleStreamedIn(vehicleid)