From 5242eac4ac7efca164cadaefe516488c4f5f72cb Mon Sep 17 00:00:00 2001 From: RD42 <42702181+dashr9230@users.noreply.github.com> Date: Fri, 20 Sep 2024 23:47:34 +0800 Subject: [PATCH] [server] Implement/match `n_GetPlayerVehicleSeat(...)` --- server/player.h | 2 +- server/scrcustom.cpp | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/server/player.h b/server/player.h index 1068d9b..89864f8 100644 --- a/server/player.h +++ b/server/player.h @@ -182,7 +182,7 @@ public: BOOL m_bHasSpawnInfo; char field_2C2F; char field_2C30; - char field_2C31; + BYTE m_byteSeatID; VEHICLEID m_VehicleID; DWORD m_dwColor; BOOL m_bCheckpointEnabled; diff --git a/server/scrcustom.cpp b/server/scrcustom.cpp index 8313269..a804d0b 100644 --- a/server/scrcustom.cpp +++ b/server/scrcustom.cpp @@ -946,10 +946,18 @@ static cell AMX_NATIVE_CALL n_GetPlayerVehicleID(AMX *amx, cell *params) return 0; } +// native GetPlayerVehicleSeat(playerid) static cell AMX_NATIVE_CALL n_GetPlayerVehicleSeat(AMX *amx, cell *params) { - // TODO: GetPlayerVehicleSeat - return 0; + CPlayer *pPlayer = pNetGame->GetPlayerPool()->GetAt((PLAYERID)params[1]); + if (!pPlayer) return -1; + + if (pPlayer->GetState() == PLAYER_STATE_DRIVER || + pPlayer->GetState() == PLAYER_STATE_PASSENGER) + return pPlayer->m_byteSeatID; + + // Vehicle not found or the player isn't in it; + return -1; } static cell AMX_NATIVE_CALL n_GetPlayerSurfingVehicleID(AMX *amx, cell *params)