From caa9b106c30779720b2e2e726a19af42b7ee85b1 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 20:06:16 +0100 Subject: [PATCH 1/8] Implement isPedEnteringToVehicle & isPedExitingFromVehicle to client side --- Client/mods/deathmatch/logic/CClientPed.cpp | 13 ++++++++++++- Client/mods/deathmatch/logic/CClientPed.h | 3 +++ .../logic/luadefs/CLuaCompatibilityDefs.cpp | 2 ++ .../mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp | 10 ++++++++++ Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 2 ++ 5 files changed, 29 insertions(+), 1 deletion(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 5b977047aa..112e915d88 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -7279,4 +7279,15 @@ void CClientPed::RunSwimTask() const inWaterTask->SetAsPedTask(m_pPlayerPed, TASK_PRIORITY_EVENT_RESPONSE_NONTEMP, true); } - \ No newline at end of file + +bool CClientPed::IsEnteringToVehicle() +{ + bool inOutState = GetVehicleInOutState(); + return inOutState == VEHICLE_INOUT_GETTING_IN || inOutState == VEHICLE_INOUT_JACKING; +} + +bool CClientPed::IsExitingFromVehicle() +{ + bool inOutState = GetVehicleInOutState(); + return inOutState == VEHICLE_INOUT_GETTING_OUT || inOutState == VEHICLE_INOUT_GETTING_JACKED; +} diff --git a/Client/mods/deathmatch/logic/CClientPed.h b/Client/mods/deathmatch/logic/CClientPed.h index e4153ee5b7..dcc0558939 100644 --- a/Client/mods/deathmatch/logic/CClientPed.h +++ b/Client/mods/deathmatch/logic/CClientPed.h @@ -267,6 +267,9 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule void WarpIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat = 0); CClientVehicle* RemoveFromVehicle(bool bIgnoreIfGettingOut = false); + bool IsEnteringToVehicle(); + bool IsExitingFromVehicle(); + bool IsVisible(); void SetVisible(bool bVisible); bool GetUsesCollision(); diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp index bb0fc1efdf..43140265e2 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp @@ -71,6 +71,8 @@ void CLuaCompatibilityDefs::LoadFunctions() {"getControlState", ArgumentParserWarn}, {"setCameraShakeLevel", ArgumentParserWarn}, {"getCameraShakeLevel", ArgumentParserWarn}, + {"isPedEnteringToVehicle", ArgumentParserWarn}, + {"isPedExitingFromVehicle", ArgumentParserWarn}, }; // Add functions diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 68b707d14b..6d6d742bac 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -2560,3 +2560,13 @@ void CLuaPedDefs::PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional< ped->Say(speechContextId, probability.value_or(1.0f)); } + +bool CLuaPedDefs::IsPedEnteringToVehicle(CClientPed* const ped) +{ + return ped->IsEnteringToVehicle(); +} + +bool CLuaPedDefs::IsPedExitingFromVehicle(CClientPed* const ped) +{ + return ped->IsExitingFromVehicle(); +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 20ec1aa590..81d3b3cc7d 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -120,4 +120,6 @@ class CLuaPedDefs : public CLuaDefs static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional gracefully); static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional probability); + bool IsPedEnteringToVehicle(CClientPed* const ped); + bool IsPedExitingFromVehicle(CClientPed* const ped); }; From 07e4716f8598b8de4ac9e54417ca0edb54dd7e76 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 20:09:04 +0100 Subject: [PATCH 2/8] typo --- Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 81d3b3cc7d..5c837512a4 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -120,6 +120,6 @@ class CLuaPedDefs : public CLuaDefs static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional gracefully); static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional probability); - bool IsPedEnteringToVehicle(CClientPed* const ped); - bool IsPedExitingFromVehicle(CClientPed* const ped); + static bool IsPedEnteringToVehicle(CClientPed* const ped); + static bool IsPedExitingFromVehicle(CClientPed* const ped); }; From 7d620b2431ffecc80a93e65040c2d697aad4e988 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 20:13:46 +0100 Subject: [PATCH 3/8] typo --- Client/mods/deathmatch/logic/CClientPed.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 112e915d88..25df7cceb6 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -7282,12 +7282,12 @@ void CClientPed::RunSwimTask() const bool CClientPed::IsEnteringToVehicle() { - bool inOutState = GetVehicleInOutState(); + int inOutState = GetVehicleInOutState(); return inOutState == VEHICLE_INOUT_GETTING_IN || inOutState == VEHICLE_INOUT_JACKING; } bool CClientPed::IsExitingFromVehicle() { - bool inOutState = GetVehicleInOutState(); + int inOutState = GetVehicleInOutState(); return inOutState == VEHICLE_INOUT_GETTING_OUT || inOutState == VEHICLE_INOUT_GETTING_JACKED; } From be3959b180a35f1efbf52f05fee5e321e3ecb552 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 20:31:46 +0100 Subject: [PATCH 4/8] Implement for serverside too --- .../mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp | 2 ++ .../mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp | 14 ++++++++++++++ Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 6d6d742bac..79c96d84ab 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -213,6 +213,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setExitVehicle", "setPedExitVehicle"); lua_classfunction(luaVM, "setBleeding", "setPedBleeding"); lua_classfunction(luaVM, "playVoiceLine", "playPedVoiceLine"); + lua_classfunction(luaVM, "isEnteringToVehicle", "isPedEnteringToVehicle"); + lua_classfunction(luaVM, "isExitingFromVehicle", "isPedExitingFromVehicle"); lua_classvariable(luaVM, "vehicle", OOP_WarpPedIntoVehicle, GetPedOccupiedVehicle); lua_classvariable(luaVM, "vehicleSeat", NULL, "getPedOccupiedVehicleSeat"); diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 1d10a05916..4aa959a388 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -49,6 +49,8 @@ void CLuaPedDefs::LoadFunctions() {"getPedOccupiedVehicleSeat", GetPedOccupiedVehicleSeat}, {"isPedInVehicle", IsPedInVehicle}, {"isPedReloadingWeapon", ArgumentParser}, + {"isPedEnteringToVehicle", ArgumentParser}, + {"isPedExitingFromVehicle", ArgumentParser}, // Ped set functions {"setPedArmor", ArgumentParserWarn}, @@ -120,6 +122,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "isHeadless", "isPedHeadless"); lua_classfunction(luaVM, "isWearingJetpack", "isPedWearingJetpack"); // introduced in 1.5.5-9.13846 lua_classfunction(luaVM, "isReloadingWeapon", "isPedReloadingWeapon"); + lua_classfunction(luaVM, "isEnteringToVehicle", "isPedEnteringToVehicle"); + lua_classfunction(luaVM, "isExitingFromVehicle", "isPedExitingFromVehicle"); lua_classfunction(luaVM, "getArmor", "getPedArmor"); lua_classfunction(luaVM, "getFightingStyle", "getPedFightingStyle"); @@ -1555,3 +1559,13 @@ int CLuaPedDefs::TakeAllWeapons(lua_State* luaVM) lua_pushboolean(luaVM, false); return 1; } + +bool CLuaPedDefs::IsPedEnteringToVehicle(CPed* const ped) noexcept +{ + return ped->GetVehicleAction() == CPed::VEHICLEACTION_ENTERING; +} + +bool CLuaPedDefs::IsPedExitingFromVehicle(CPed* const ped) noexcept +{ + return ped->GetVehicleAction() == CPed::VEHICLEACTION_EXITING; +} diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 407a052e21..39908f63db 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -80,4 +80,6 @@ class CLuaPedDefs : public CLuaDefs LUA_DECLARE(SetPedHeadless); LUA_DECLARE(SetPedFrozen); static bool ReloadPedWeapon(lua_State* vm, CPed* const ped) noexcept; + bool IsPedEnteringToVehicle(CPed* const ped) noexcept; + bool IsPedExitingFromVehicle(CPed* const ped) noexcept; }; From 0fc4abb689a1501e2e5659b76b8a8b295ef6a1ed Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 21:21:10 +0100 Subject: [PATCH 5/8] Implement getPedOccupiedVehicleEnteringTo & fixes --- .../logic/luadefs/CLuaCompatibilityDefs.cpp | 2 -- .../deathmatch/logic/luadefs/CLuaPedDefs.cpp | 17 +++++++++++++++-- .../mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 5 +++-- .../deathmatch/logic/luadefs/CLuaPedDefs.cpp | 4 +++- .../mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 4 ++-- 5 files changed, 23 insertions(+), 9 deletions(-) diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp index 43140265e2..bb0fc1efdf 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaCompatibilityDefs.cpp @@ -71,8 +71,6 @@ void CLuaCompatibilityDefs::LoadFunctions() {"getControlState", ArgumentParserWarn}, {"setCameraShakeLevel", ArgumentParserWarn}, {"getCameraShakeLevel", ArgumentParserWarn}, - {"isPedEnteringToVehicle", ArgumentParserWarn}, - {"isPedExitingFromVehicle", ArgumentParserWarn}, }; // Add functions diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 79c96d84ab..9482c9e011 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -104,6 +104,10 @@ void CLuaPedDefs::LoadFunctions() {"getPedTotalAmmo", GetPedTotalAmmo}, {"getPedOccupiedVehicle", GetPedOccupiedVehicle}, {"getPedOccupiedVehicleSeat", GetPedOccupiedVehicleSeat}, + {"isPedEnteringToVehicle", ArgumentParser}, + {"isPedExitingFromVehicle", ArgumentParser}, + {"getPedOccupiedVehicleEnteringTo", ArgumentParser}, + {"getPedBonePosition", GetPedBonePosition}, {"getPedClothes", GetPedClothes}, {"getPedMoveState", GetPedMoveState}, @@ -155,6 +159,7 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getMoveState", "getPedMoveState"); lua_classfunction(luaVM, "getOccupiedVehicle", "getPedOccupiedVehicle"); lua_classfunction(luaVM, "getOccupiedVehicleSeat", "getPedOccupiedVehicleSeat"); + lua_classfunction(luaVM, "getOccupiedVehicleEnteringTo", "getPedOccupiedVehicleEnteringTo"); lua_classfunction(luaVM, "getOxygenLevel", "getPedOxygenLevel"); lua_classfunction(luaVM, "getStat", "getPedStat"); lua_classfunction(luaVM, "getTarget", "getPedTarget"); @@ -234,6 +239,9 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classvariable(luaVM, "ducked", NULL, "isPedDucked"); lua_classvariable(luaVM, "headless", "setPedHeadless", "isPedHeadless"); lua_classvariable(luaVM, "inVehicle", NULL, "isPedInVehicle"); + lua_classvariable(luaVM, "enteringToVehicle", NULL, "isPedEnteringToVehicle"); + lua_classvariable(luaVM, "exitingFromVehicle", NULL, "isPedExitingFromVehicle"); + lua_classvariable(luaVM, "occupiedVehicleEnteringTo", NULL, "getPedOccupiedVehicleEnteringTo"); lua_classvariable(luaVM, "onFire", "setPedOnFire", "isPedOnFire"); lua_classvariable(luaVM, "onGround", NULL, "isPedOnGround"); lua_classvariable(luaVM, "dead", NULL, "isPedDead"); @@ -2563,12 +2571,17 @@ void CLuaPedDefs::PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional< ped->Say(speechContextId, probability.value_or(1.0f)); } -bool CLuaPedDefs::IsPedEnteringToVehicle(CClientPed* const ped) +bool CLuaPedDefs::IsPedEnteringToVehicle(CClientPed* const ped) noexcept { return ped->IsEnteringToVehicle(); } -bool CLuaPedDefs::IsPedExitingFromVehicle(CClientPed* const ped) +bool CLuaPedDefs::IsPedExitingFromVehicle(CClientPed* const ped) noexcept { return ped->IsExitingFromVehicle(); } + +CClientVehicle* CLuaPedDefs::GetPedOccupiedVehicleEnteringTo(CClientPed* const ped) +{ + return ped->GetOccupyingVehicle(); +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 5c837512a4..6e7a14be6f 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -120,6 +120,7 @@ class CLuaPedDefs : public CLuaDefs static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional gracefully); static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional probability); - static bool IsPedEnteringToVehicle(CClientPed* const ped); - static bool IsPedExitingFromVehicle(CClientPed* const ped); + static bool IsPedEnteringToVehicle(CClientPed* const ped) noexcept; + static bool IsPedExitingFromVehicle(CClientPed* const ped) noexcept; + static CClientVehicle* GetPedOccupiedVehicleEnteringTo(CClientPed* const ped); }; diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 4aa959a388..b3756455dd 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -48,9 +48,9 @@ void CLuaPedDefs::LoadFunctions() {"getPedOccupiedVehicle", GetPedOccupiedVehicle}, {"getPedOccupiedVehicleSeat", GetPedOccupiedVehicleSeat}, {"isPedInVehicle", IsPedInVehicle}, - {"isPedReloadingWeapon", ArgumentParser}, {"isPedEnteringToVehicle", ArgumentParser}, {"isPedExitingFromVehicle", ArgumentParser}, + {"isPedReloadingWeapon", ArgumentParser}, // Ped set functions {"setPedArmor", ArgumentParserWarn}, @@ -157,6 +157,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "setWearingJetpack", "setPedWearingJetpack"); // introduced in 1.5.5-9.13846 lua_classvariable(luaVM, "inVehicle", NULL, "isPedInVehicle"); + lua_classvariable(luaVM, "enteringToVehicle", NULL, "isPedEnteringToVehicle"); + lua_classvariable(luaVM, "exitingFromVehicle", NULL, "isPedExitingFromVehicle"); lua_classvariable(luaVM, "ducked", NULL, "isPedDucked"); lua_classvariable(luaVM, "inWater", NULL, "isPedInWater"); lua_classvariable(luaVM, "onGround", NULL, "isPedOnGround"); diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 39908f63db..3cbf632d00 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -80,6 +80,6 @@ class CLuaPedDefs : public CLuaDefs LUA_DECLARE(SetPedHeadless); LUA_DECLARE(SetPedFrozen); static bool ReloadPedWeapon(lua_State* vm, CPed* const ped) noexcept; - bool IsPedEnteringToVehicle(CPed* const ped) noexcept; - bool IsPedExitingFromVehicle(CPed* const ped) noexcept; + static bool IsPedEnteringToVehicle(CPed* const ped) noexcept; + static bool IsPedExitingFromVehicle(CPed* const ped) noexcept; }; From dc27c0bdfa042968bf5e1ac5d24430fc3d52b7c7 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 21:42:30 +0100 Subject: [PATCH 6/8] Finalize all functions --- Client/mods/deathmatch/logic/CClientPed.cpp | 4 ++-- Client/mods/deathmatch/logic/CClientPed.h | 4 +++- Client/mods/deathmatch/logic/CClientVehicle.cpp | 5 ++--- .../deathmatch/logic/luadefs/CLuaPedDefs.cpp | 16 ++++++++++++---- .../mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 3 ++- 5 files changed, 21 insertions(+), 11 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.cpp b/Client/mods/deathmatch/logic/CClientPed.cpp index 25df7cceb6..4d8fea8556 100644 --- a/Client/mods/deathmatch/logic/CClientPed.cpp +++ b/Client/mods/deathmatch/logic/CClientPed.cpp @@ -127,7 +127,7 @@ void CClientPed::Init(CClientManager* pManager, unsigned long ulModelID, bool bI m_pTaskManager = NULL; m_pOccupiedVehicle = NULL; m_pOccupyingVehicle = NULL; - // m_uiOccupyingSeat = 0; + m_uiOccupyingSeat = 0; m_uiOccupiedVehicleSeat = 0xFF; m_bHealthLocked = false; m_bDontChangeRadio = false; @@ -1464,7 +1464,7 @@ void CClientPed::WarpIntoVehicle(CClientVehicle* pVehicle, unsigned int uiSeat) CClientVehicle* pPrevVehicle = GetRealOccupiedVehicle(); // Eventually remove us from a previous vehicle RemoveFromVehicle(); - // m_uiOccupyingSeat = uiSeat; + m_uiOccupyingSeat = uiSeat; m_bForceGettingIn = false; m_bForceGettingOut = false; m_ucLeavingDoor = 0xFF; diff --git a/Client/mods/deathmatch/logic/CClientPed.h b/Client/mods/deathmatch/logic/CClientPed.h index dcc0558939..5f04c01e25 100644 --- a/Client/mods/deathmatch/logic/CClientPed.h +++ b/Client/mods/deathmatch/logic/CClientPed.h @@ -254,6 +254,8 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule CClientVehicle* GetOccupyingVehicle() noexcept { return m_pOccupyingVehicle; }; const CClientVehicle* GetOccupyingVehicle() const noexcept { return m_pOccupyingVehicle; }; + unsigned int GetOccupyingVehicleSeat() const noexcept { return m_uiOccupyingSeat; }; + CClientVehicle* GetRealOccupiedVehicle(); CClientVehicle* GetClosestEnterableVehicle(bool bGetPositionFromClosestDoor, bool bCheckDriverDoor, bool bCheckPassengerDoors, bool bCheckStreamedOutVehicles, unsigned int* uiClosestDoor = NULL, CVector* pClosestDoorPosition = NULL, @@ -647,7 +649,7 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule unsigned long m_ulLastOnScreenTime; CClientVehiclePtr m_pOccupiedVehicle; CClientVehiclePtr m_pOccupyingVehicle; - // unsigned int m_uiOccupyingSeat; + unsigned int m_uiOccupyingSeat; unsigned int m_uiOccupiedVehicleSeat; bool m_bForceGettingIn; bool m_bForceGettingOut; diff --git a/Client/mods/deathmatch/logic/CClientVehicle.cpp b/Client/mods/deathmatch/logic/CClientVehicle.cpp index e47c40e2e5..12bccab460 100644 --- a/Client/mods/deathmatch/logic/CClientVehicle.cpp +++ b/Client/mods/deathmatch/logic/CClientVehicle.cpp @@ -4139,8 +4139,7 @@ void CClientVehicle::SetPedOccupyingVehicle(CClientPed* pClientPed, CClientVehic // Ped vars pClientPed->m_pOccupyingVehicle = pVehicle; - // if ( uiSeat >= 0 && uiSeat < 8 ) - // pClientPed->m_uiOccupyingSeat = uiSeat; + pClientPed->m_uiOccupyingSeat = uiSeat; if (ucDoor != 0xFF) pVehicle->AllowDoorRatioSetting(ucDoor, false); @@ -4266,7 +4265,7 @@ void CClientVehicle::UnpairPedAndVehicle(CClientPed* pClientPed, CClientVehicle* { INFO(("UnpairPedAndVehicle: pClientPed:%s from m_pOccupyingVehicle:0x%08x", GetPlayerName(pClientPed).c_str(), pVehicle)); pClientPed->m_pOccupyingVehicle = NULL; - // pClientPed->m_uiOccupyingSeat = 0xFF; + pClientPed->m_uiOccupyingSeat = NULL; } } diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp index 9482c9e011..fc5627ad1f 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.cpp @@ -106,7 +106,8 @@ void CLuaPedDefs::LoadFunctions() {"getPedOccupiedVehicleSeat", GetPedOccupiedVehicleSeat}, {"isPedEnteringToVehicle", ArgumentParser}, {"isPedExitingFromVehicle", ArgumentParser}, - {"getPedOccupiedVehicleEnteringTo", ArgumentParser}, + {"getPedVehicleEnteringTo", ArgumentParser}, + {"getPedVehicleEnteringToSeat", ArgumentParser}, {"getPedBonePosition", GetPedBonePosition}, {"getPedClothes", GetPedClothes}, @@ -159,7 +160,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classfunction(luaVM, "getMoveState", "getPedMoveState"); lua_classfunction(luaVM, "getOccupiedVehicle", "getPedOccupiedVehicle"); lua_classfunction(luaVM, "getOccupiedVehicleSeat", "getPedOccupiedVehicleSeat"); - lua_classfunction(luaVM, "getOccupiedVehicleEnteringTo", "getPedOccupiedVehicleEnteringTo"); + lua_classfunction(luaVM, "getVehicleEnteringTo", "getPedVehicleEnteringTo"); + lua_classfunction(luaVM, "getVehicleEnteringToSeat", "getPedVehicleEnteringToSeat"); lua_classfunction(luaVM, "getOxygenLevel", "getPedOxygenLevel"); lua_classfunction(luaVM, "getStat", "getPedStat"); lua_classfunction(luaVM, "getTarget", "getPedTarget"); @@ -241,7 +243,8 @@ void CLuaPedDefs::AddClass(lua_State* luaVM) lua_classvariable(luaVM, "inVehicle", NULL, "isPedInVehicle"); lua_classvariable(luaVM, "enteringToVehicle", NULL, "isPedEnteringToVehicle"); lua_classvariable(luaVM, "exitingFromVehicle", NULL, "isPedExitingFromVehicle"); - lua_classvariable(luaVM, "occupiedVehicleEnteringTo", NULL, "getPedOccupiedVehicleEnteringTo"); + lua_classvariable(luaVM, "vehicleEnteringTo", NULL, "getPedVehicleEnteringTo"); + lua_classvariable(luaVM, "vehicleEnteringToSeat", NULL, "getPedVehicleEnteringToSeat"); lua_classvariable(luaVM, "onFire", "setPedOnFire", "isPedOnFire"); lua_classvariable(luaVM, "onGround", NULL, "isPedOnGround"); lua_classvariable(luaVM, "dead", NULL, "isPedDead"); @@ -2581,7 +2584,12 @@ bool CLuaPedDefs::IsPedExitingFromVehicle(CClientPed* const ped) noexcept return ped->IsExitingFromVehicle(); } -CClientVehicle* CLuaPedDefs::GetPedOccupiedVehicleEnteringTo(CClientPed* const ped) +CClientVehicle* CLuaPedDefs::GetPedVehicleEnteringTo(CClientPed* const ped) { return ped->GetOccupyingVehicle(); } + +int CLuaPedDefs::GetPedVehicleEnteringToSeat(CClientPed* const ped) +{ + return ped->GetOccupyingVehicleSeat(); +} diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 6e7a14be6f..a7d1b1d0e1 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -122,5 +122,6 @@ class CLuaPedDefs : public CLuaDefs static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional probability); static bool IsPedEnteringToVehicle(CClientPed* const ped) noexcept; static bool IsPedExitingFromVehicle(CClientPed* const ped) noexcept; - static CClientVehicle* GetPedOccupiedVehicleEnteringTo(CClientPed* const ped); + static CClientVehicle* GetPedVehicleEnteringTo(CClientPed* const ped); + static int GetPedVehicleEnteringToSeat(CClientPed* const ped); }; From 55c53b7bc7f4988e0317164b6611d24ece4f2431 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Fri, 14 Nov 2025 22:00:08 +0100 Subject: [PATCH 7/8] fix --- Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 3cbf632d00..2409d50566 100644 --- a/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Server/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -51,6 +51,8 @@ class CLuaPedDefs : public CLuaDefs LUA_DECLARE(GetPedOccupiedVehicle); LUA_DECLARE(GetPedOccupiedVehicleSeat); LUA_DECLARE(IsPedInVehicle); + static bool IsPedEnteringToVehicle(CPed* const ped) noexcept; + static bool IsPedExitingFromVehicle(CPed* const ped) noexcept; LUA_DECLARE(GetPedAmmoInClip); LUA_DECLARE(GetPedTotalAmmo); static bool IsPedReloadingWeapon(CPed* const ped) noexcept; @@ -80,6 +82,4 @@ class CLuaPedDefs : public CLuaDefs LUA_DECLARE(SetPedHeadless); LUA_DECLARE(SetPedFrozen); static bool ReloadPedWeapon(lua_State* vm, CPed* const ped) noexcept; - static bool IsPedEnteringToVehicle(CPed* const ped) noexcept; - static bool IsPedExitingFromVehicle(CPed* const ped) noexcept; }; From 67b878b11f9df64e4cf5d76da516792e43cd7167 Mon Sep 17 00:00:00 2001 From: Xenius97 Date: Thu, 22 Jan 2026 20:43:17 +0100 Subject: [PATCH 8/8] fix clang --- Client/mods/deathmatch/logic/CClientPed.h | 18 +++++++++--------- .../deathmatch/logic/luadefs/CLuaPedDefs.h | 8 ++++---- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/Client/mods/deathmatch/logic/CClientPed.h b/Client/mods/deathmatch/logic/CClientPed.h index d532ce8e79..045f523860 100644 --- a/Client/mods/deathmatch/logic/CClientPed.h +++ b/Client/mods/deathmatch/logic/CClientPed.h @@ -646,15 +646,15 @@ class CClientPed : public CClientStreamElement, public CAntiCheatModule CClientVehiclePtr m_pOccupiedVehicle; CClientVehiclePtr m_pOccupyingVehicle; unsigned int m_uiOccupyingSeat; - unsigned int m_uiOccupiedVehicleSeat; - bool m_bForceGettingIn; - bool m_bForceGettingOut; - CShotSyncData* m_shotSyncData; - CStatsData* m_stats; - CControllerState* m_currentControllerState; - CControllerState* m_lastControllerState; - CControllerState m_rawControllerState; // copy of lastControllerState before CClientPed::ApplyControllerStateFixes is applied (modifies states to - // prevent stuff like rapid input glitch) + unsigned int m_uiOccupiedVehicleSeat; + bool m_bForceGettingIn; + bool m_bForceGettingOut; + CShotSyncData* m_shotSyncData; + CStatsData* m_stats; + CControllerState* m_currentControllerState; + CControllerState* m_lastControllerState; + CControllerState m_rawControllerState; // copy of lastControllerState before CClientPed::ApplyControllerStateFixes is applied (modifies states to + // prevent stuff like rapid input glitch) CRemoteDataStorage* m_remoteDataStorage; unsigned long m_ulLastTimeFired; unsigned long m_ulLastTimeBeganAiming; diff --git a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h index 2d323026f5..e6a4e610d3 100644 --- a/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h +++ b/Client/mods/deathmatch/logic/luadefs/CLuaPedDefs.h @@ -119,9 +119,9 @@ class CLuaPedDefs : public CLuaDefs static bool killPedTask(CClientPed* ped, taskType taskType, std::uint8_t taskNumber, std::optional gracefully); - static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional probability); - static bool IsPedEnteringToVehicle(CClientPed* const ped) noexcept; - static bool IsPedExitingFromVehicle(CClientPed* const ped) noexcept; + static void PlayPedVoiceLine(CClientPed* ped, int speechId, std::optional probability); + static bool IsPedEnteringToVehicle(CClientPed* const ped) noexcept; + static bool IsPedExitingFromVehicle(CClientPed* const ped) noexcept; static CClientVehicle* GetPedVehicleEnteringTo(CClientPed* const ped); - static int GetPedVehicleEnteringToSeat(CClientPed* const ped); + static int GetPedVehicleEnteringToSeat(CClientPed* const ped); };