From 92d3ae8132b8c4bc5d075c3ef155aa4ed7d6974d Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 26 Feb 2021 15:41:21 +0000 Subject: [PATCH] feat: func to get ped in opposite seat if driver/passenger --- cl_player.lua | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cl_player.lua b/cl_player.lua index 28a8b6d..de0fa53 100644 --- a/cl_player.lua +++ b/cl_player.lua @@ -67,6 +67,17 @@ function PLY:CanControlRadar() return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerControlAllowed() ) end +-- Returns the ped in the opposite seat to the player, e.g. if we're the passenger, then return the driver +function PLY:GetOtherPed() + if ( self:IsDriver() ) then + return GetPedInVehicleSeat( PLY.veh, 0 ) + elseif ( self:IsPassenger() ) then + return GetPedInVehicleSeat( PLY.veh, -1 ) + end + + return nil +end + -- The main purpose of this thread is to update the information about the local player, including their -- ped id, the vehicle id (if they're in one), whether they're in a driver seat, and if the vehicle's class -- is valid or not