Hello. I have a simple item that puts tent in front of the player. The problem is when I put z = z - 1.0 it doesn’t change the height at all and it’s flying in the air. I tried increasing that to - 2.0 but that still doesn’t change anything and when I put -3.0 then it’s under the floor.
client.lua
RegisterNetEvent('esx_extraitems:campfire')
AddEventHandler('esx_extraitems:campfire', function()
local model = {
'prop_skid_tent_03',
'prop_skid_tent_01'
}
model = model[math.random(#model)]
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local forward = GetEntityForwardVector(playerPed)
local x, y, z = table.unpack(coords + forward * 1.5)
z = z - 2.0
ESX.Game.SpawnObject(model, {
x = x,
y = y,
z = z
}, function(obj)
SetEntityHeading(obj, GetEntityHeading(playerPed))
PlaceObjectOnGroundProperly(obj)
end)
TriggerEvent("pNotify:SendNotification", {
layout = "bottomRight",
text = "Rozpaliłeś ognisko",
type = "info",
theme = "gta",
sounds = {
sources = {"notification.wav"}, -- For sounds to work, you place your sound in the html folder and then add it to the files array in the __resource.lua file.
volume = 0.2,
conditions = {"docVisible"} -- This means it will play the sound when the notification becomes visible.
}
})
end)
Any help appreciated because I don’t know why it doesn’t work.