feat: func to get ped in opposite seat if driver/passenger

This commit is contained in:
Dan
2021-02-26 15:41:21 +00:00
parent ff668a92fc
commit 92d3ae8132

View File

@@ -67,6 +67,17 @@ function PLY:CanControlRadar()
return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerControlAllowed() ) return self:IsDriver() or ( self:IsPassenger() and RADAR:IsPassengerControlAllowed() )
end 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 -- 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 -- 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 -- is valid or not