Added PMETA:GetSitting

This commit is contained in:
Xerasin 2021-01-27 08:35:45 -08:00
parent 16d12c1b55
commit 52565e5c20
2 changed files with 16 additions and 1 deletions

View File

@ -155,4 +155,18 @@ function PMETA:IsPlayerSittingOn(ply)
if IsValid(v:GetDriver()) and v:GetDriver() == self then return true end
end
return false
end
end
function PMETA:GetSitting()
if not IsValid(self:GetVehicle()) then return false end
local veh = self:GetVehicle()
if veh:GetNWBool("playerdynseat", false) then
local parent = veh:GetParent()
if IsValid(parent) and parent:GetClass() == "sit_holder" then
return veh, parent
else
return veh
end
end
return false
end

View File

@ -71,6 +71,7 @@ local function Sit(ply, pos, ang, parent, parentbone, func, exit)
vehicle:SetPos(pos)
vehicle.playerdynseat = true
vehicle:SetNWBool("playerdynseat", true)
vehicle.oldpos = vehicle:WorldToLocal(ply:GetPos())
vehicle.oldang = vehicle:WorldToLocalAngles(ply:EyeAngles())
vehicle.wasCrouching = ply:Crouching()