From f74fc485c4d490cd1e2d24f9ad8b1cbb274621ef Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Wed, 18 Sep 2024 23:37:53 +0800 Subject: [PATCH] [server] Implement/match `n_IsPlayerInAnyVehicle(...)` --- server/scrcustom.cpp | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/server/scrcustom.cpp b/server/scrcustom.cpp index d21da96..d62813c 100644 --- a/server/scrcustom.cpp +++ b/server/scrcustom.cpp @@ -994,9 +994,18 @@ static cell AMX_NATIVE_CALL n_IsPlayerInVehicle(AMX *amx, cell *params) return 0; } +// native IsPlayerInAnyVehicle(playerid) static cell AMX_NATIVE_CALL n_IsPlayerInAnyVehicle(AMX *amx, cell *params) { - // TODO: IsPlayerInAnyVehicle + CPlayer* pPlayer = pNetGame->GetPlayerPool()->GetAt((PLAYERID)params[1]); + if (!pPlayer) return 0; + BYTE byteState = pPlayer->GetState(); + + if ((byteState == PLAYER_STATE_DRIVER) || (byteState == PLAYER_STATE_PASSENGER)) + { + return 1; + } + return 0; }