Code used
print('insidevehicle', self.id, GetVehiclePedIsIn(self.id, false))
executed while in a car
What I get
This was working on previous FX versions.
I’m using OneSync infinity
Resource used for this:
The error is at server/ped.lua
print('insidevehicle', self.id, GetVehiclePedIsIn(self.id, false))
executed while in a car
I’m using OneSync infinity
The error is at server/ped.lua
Also having the same issue. Can confirm this is a problem on the later builds.
GetVehiclePedIsIn(GetPlayerPed(client))
Results in:
client & GetPlayerPed(client) & GetVehiclePedIsIn(client) 1 131073 0
However, I did some further testing to help identify this, and found that if I iterate through all players and all vehicles and check for distance, that the script will recognize the vehicle the player is in. So it’s not that the server doesn’t know the vehicle(s) exist, it’s that it’s just not detecting what vehicle the player is in.
RegisterCommand('plyvehicle', function(s,a,r)
local plys = GetPlayers()
local vehs = GetAllVehicles()
for _,i in ipairs(plys) do
local ply = tonumber(i)
print("",
ply,GetPlayerPed(ply),
GetVehiclePedIsIn(GetPlayerPed(ply))
)
local plyPos = GetEntityCoords(GetPlayerPed(ply))
for _,v in ipairs(vehs) do
local veh = tonumber(v)
if #(plyPos - GetEntityCoords(veh)) < 2.0 then
print("Player is inside Vehicle #"..veh)
end
end
end
end)
Does this happen with 1604/2060 as well?
It worked for me with older builds.
From 2189 I will not get a return (0).
Same outcome for my server as well (works 2060). Also, running Linux. Once I get up in the afternoon I’ll play with the builds / force build arg and see if I can get some results for you.
Should (hopefully) be resolved anyway as of 3326.
Absolutely is, thank you again for the hard work. My makeshift function above returned the same value this time instead of zero.
3 145945 0
1 131073 143878
Player is inside Vehicle #143878
This is on Build 3336, with Cayo Perico DLC on.