From a06972c57d9049b60cbff78a3b06b80905adb181 Mon Sep 17 00:00:00 2001 From: Dan Date: Thu, 11 Mar 2021 18:50:45 +0000 Subject: [PATCH] feat: add function to get other ped's server id --- cl_player.lua | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/cl_player.lua b/cl_player.lua index 6dc8351..6cecbbb 100644 --- a/cl_player.lua +++ b/cl_player.lua @@ -78,6 +78,18 @@ function PLY:GetOtherPed() return nil end +function PLY:GetOtherPedServerId() + local otherPed = self:GetOtherPed() + + if ( otherPed ~= nil and otherPed ~= 0 and IsPedAPlayer( otherPed ) ) then + local otherPly = GetPlayerServerId( NetworkGetPlayerIndexFromPed( otherPed ) ) + + return otherPly + 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