Z axis coords out of place when copying from RAW map editor file

Hi I have been having this problem for ages where I copy and paste the coordinates from my map that I made in GTA into my code, the objects height isn’t the same as before in map editor. Only the Z axis is affected and the bigger the prop, the bigger the offset.

Here’s some objects in normal GTA

And here is the exact same objects and coords in FiveM

Every object is affected but every object is effected a different amount, smaller objects are just slightly off of the floor. If i save to a ymap and stream it the objects are in the right place, but I need the objects to be spawned and deleted when needed so I need to code it in.

Ok so here is some code to spawn a few pieces of track. The objects are copied straight from a RAW save file:

--======================================
--{ DRAGSTRIP }--

local dragProps = {
	{name = "stt_prop_track_block_02", hash = 412086140, x = 487.0, y = -5607.492, z = 158.98, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -5313.654, z = 150.0, rx = 0.0, ry = 0.0, h = -90.0},
	{name = "stt_prop_track_start_02", hash = -676634917, x = 487.0, y = -5487.283, z = 150.05, rx = 0.0, ry = 0.0, h = -90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -5712.163, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -5154.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4995.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4836.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4677.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4518.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4359.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4200.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -4041.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3882.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3723.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3723.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3405.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3564.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3246.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "stt_prop_track_straight_bar_l", hash = -780495775, x = 487.0, y = -3087.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "sr_prop_track_straight_l_u30", hash = -2065716143, x = 487.0, y = -2928.65, z = 150.0, rx = 0.0, ry = 0.0, h = 90.0},
	{name = "xs_prop_arena_finish_line", hash = 1575657223, x = 484.2745, y = -3045.792, z = 150.0998, rx = 0.0, ry = 0.0, h = 0.0},
	{name = "v_serv_metro_advertstand2", hash = 275794448, x = 477.3023, y = -3045.549, z = 153.06, rx = 0.0, ry = 0.0, h = 0.0},
	{name = "v_serv_metro_advertstand2", hash = 275794448, x = 496.6928, y = -3045.679, z = 153.06, rx = 0.0, ry = 0.0, h = 0.0}
	
}

local propHeight = 150.0
local propx = 487.0
local objDist = 3500.0
local propSpawned = false
local loc = { 487.0, -5712.163, 150.0 }

RegisterNetEvent("dragstripobj")
AddEventHandler("dragstripobj", function()
	for k, info in pairs(dragProps) do
		RequestModel(info.hash)
		while not HasModelLoaded(info.hash) do
			Wait(1)
		end
		dragstripObj = CreateObject(info.hash, info.x, info.y, info.z, true, true)
			SetEntityRotation(dragstripObj, info.rx, info.ry, info.h, 2, true)
			SetEntityAsMissionEntity(dragstripObj, true, true)
			FreezeEntityPosition(dragstripObj, true)
			SetModelAsNoLongerNeeded(info.hash)
	end
end)

--SpawnOBJ--
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		local me = GetPlayerPed(-1)
		local whr = GetEntityCoords(me, false)
		local dist = Vdist(whr.x, whr.y, whr.z, loc[1], loc[2], loc[3])
		if dist <= objDist then
			if propSpawned == false then
				TriggerEvent("dragstripobj")
				propSpawned = true
				
			end
		else
			if propSpawned == true then
				TriggerEvent("deldragstrip")
				propSpawned = false
			end
		end
	end
end)

--Del--
RegisterNetEvent("deldragstrip")
AddEventHandler("deldragstrip", function()
	for k, info in pairs(dragProps) do
		DeleteObject(dragstripObj)
	end
end)

If you look at the first object in the table:

{name = "stt_prop_track_block_02", hash = 412086140, x = 487.0, y = -5607.492, z = 158.98, rx = 0.0, ry = 0.0, h = 90.0},

The coords are exactly the same as this:

So why is it coming out like this:

I’m still quite new to this so no doubt I am going about this all wrong. Any help will be appreciated :slight_smile:

Ok now I feel stupid. CreateObjectNoOffset(). Duh :unamused: