Hi, I’m adapting my server for OneSync Infinity and I’m stuck with es_extended. When someone drops a pickup it appears globally on the all other players. I’ve seen a pr about this but on extendedmode, so i tried that way.
server/functions.lua
ESX.CreatePickup = function(type, name, count, label, playerId, components)
local pickupId = (ESX.PickupId == 65635 and 0 or ESX.PickupId + 1)
local xPlayer = ESX.GetPlayerFromId(playerId)
local pedCoords
if GetConvar("onesync_enableInfinity", "false") == "true" then
print('ISINFINITY')
pedCoords = GetEntityCoords(GetPlayerPed(playerId))
print(pedCoords)
end
ESX.Pickups[pickupId] = {
type = type,
name = name,
count = count,
label = label,
coords = xPlayer.getCoords(),
}
if type == 'item_weapon' then
ESX.Pickups[pickupId].components = components
end
TriggerClientEvent('esx:createPickup', -1, pickupId, label, playerId, type, name, components, pedCoords)
ESX.PickupId = pickupId
end
and on client
AddEventHandler('esx:createPickup', function(pickupId, label, playerId, type, name, components, pickupCoords)
local playerPed = GetPlayerPed(GetPlayerFromServerId(playerId))
local entityCoords, forward, pickupObject = GetEntityCoords(playerPed), GetEntityForwardVector(playerPed)
local objectCoords = (entityCoords + forward * 1.0)
print(playerId)
print(playerPed)
print(objectCoords)
print('PICKUPCOORDS')
print(pickupCoords)
if type == 'item_weapon' then
ESX.Streaming.RequestWeaponAsset(GetHashKey(name))
pickupObject = CreateWeaponObject(GetHashKey(name), 50, objectCoords, true, 1.0, 0)
for k,v in ipairs(components) do
local component = ESX.GetWeaponComponent(name, v)
GiveWeaponComponentToWeaponObject(pickupObject, component.hash)
end
elseif type == 'item_money' then
ESX.Game.SpawnLocalObject('prop_cash_case_02', objectCoords, function(obj)
pickupObject = obj
end)
print('Money coords')
print(objectCoords)
while not pickupObject do
Citizen.Wait(10)
end
elseif type == 'item_account' then
ESX.Game.SpawnLocalObject('prop_cash_case_02', objectCoords, function(obj)
pickupObject = obj
--SetEntityCollision(pickupObject, false, true)
end)
print('Money coords')
print(objectCoords)
while not pickupObject do
Citizen.Wait(10)
end
else
ESX.Game.SpawnLocalObject('p_michael_backpack_s', objectCoords, function(obj)
pickupObject = obj
end)
print('Item coords')
print(objectCoords)
while not pickupObject do
Citizen.Wait(10)
end
end
SetEntityAsMissionEntity(pickupObject, true, false)
PlaceObjectOnGroundProperly(pickupObject)
FreezeEntityPosition(pickupObject, true)
pickups[pickupId] = {
id = pickupId,
obj = pickupObject,
label = label,
inRange = false,
coords = objectCoords
}
end)
On the server the coords are right printed, but on client the coords are nil, its like if server cannot pass coords though client