local marker = {}
local markerTable = {
--x, y, z, r, g, b, dim, x1, y1, z1, rotation, int, dimension
{1788.73, -1296.87, 13.41, 255, 255, 0, 0, 1811.22, -1298.09, 22.24, 0, 0, 0}, -- Entrance marker, spawns to 1st floor | First coordinates indicate where the marker is located. Second coordinates indicate where the player will spawn. Do not put the exact spawn coordinates the same as the marker coordinates, otherwise you will get a C Stack Overflow error or it'll just spawn you somewhere else.
{1811.17, -1300.80, 22.24, 255, 255, 0, 0, 1791.13, -1292.97, 13.54, 0, 0, 0}, -- 1st floor Down marker, spawns to entrance
{1811.17, -1300.80, 27.70, 255, 255, 0, 0, 1811.22, -1298.09, 22.24, 0, 0, 0}, -- 2nd floor Down marker, spawns to 1st floor
{1811.17, -1300.80, 33.16, 255, 255, 0, 0, 1811.22, -1298.09, 27.70, 0, 0, 0}, -- 3rd floor Down marker, spawns to 2rd floor
{1811.17, -1300.89, 38.62, 255, 255, 0, 0, 1811.22, -1298.09, 33.16, 0, 0, 0}, -- 4th floor Down marker, spawns to 3rd floor
{1811.17, -1300.89, 44.09, 255, 255, 0, 0, 1811.22, -1298.09, 38.62, 0, 0, 0}, -- 5th floor Down marker, spawns to 4th floor
{1811.17, -1300.89, 49.47, 255, 255, 0, 0, 1811.22, -1298.09, 44.09, 0, 0, 0}, -- 6th floor Down marker, spawns to 5th floor
{1811.17, -1300.89, 54.93, 255, 255, 0, 0, 1811.22, -1298.09, 49.47, 0, 0, 0}, -- 7th floor Down marker, spawns to 6th floor
{1811.17, -1300.89, 60.40, 255, 255, 0, 0, 1811.22, -1298.09, 54.93, 0, 0, 0}, -- 8th floor Down marker, spawns to 7th floor
{1811.17, -1300.89, 65.85, 255, 255, 0, 0, 1811.22, -1298.09, 60.40, 0, 0, 0}, -- 9th floor Down marker, spawns to 8th floor
{1811.17, -1300.89, 71.31, 255, 255, 0, 0, 1811.22, -1298.09, 65.85, 0, 0, 0}, -- 10th floor Down marker, spawns to 9th floor
{1811.17, -1300.89, 76.70, 255, 255, 0, 0, 1811.22, -1298.09, 71.31, 0, 0, 0}, -- 11th floor Down marker, spawns to 10th floor
{1811.17, -1300.89, 82.17, 255, 255, 0, 0, 1811.22, -1298.09, 76.70, 0, 0, 0}, -- 12th floor Down marker, spawns to 11th floor
{1811.17, -1300.89, 87.62, 255, 255, 0, 0, 1811.22, -1298.09, 82.17, 0, 0, 0}, -- 13th floor Down marker, spawns to 12th floor
{1811.17, -1300.89, 93.09, 255, 255, 0, 0, 1811.22, -1298.09, 87.62, 0, 0, 0}, -- 14th floor Down marker, spawns to 13th floor
{1811.17, -1300.89, 98.54, 255, 255, 0, 0, 1811.22, -1298.09, 93.09, 0, 0, 0}, -- 15th floor Down marker, spawns to 14th floor
{1811.17, -1300.89, 103.93, 255, 255, 0, 0, 1811.22, -1298.09, 98.54, 0, 0, 0}, -- 16th floor Down marker, spawns to 15th floor
{1811.17, -1300.89, 109.40, 255, 255, 0, 0, 1811.22, -1298.09, 103.93, 0, 0, 0}, -- 17th floor Down marker, spawns to 16th floor
{1811.17, -1300.89, 114.85, 255, 255, 0, 0, 1811.22, -1298.09, 109.30, 0, 0, 0}, -- 18th floor Down marker, spawns to 17th floor
{1811.17, -1300.89, 120.30, 255, 255, 0, 0, 1811.22, -1299.09, 114.85, 0, 0, 0}, -- 19th floor Down marker, spawns to 18th floor
{1825.17, -1299.39, 22.24, 255, 255, 0, 0, 1827.09, -1299.36, 27.70, 0, 0, 0}, -- 1st floor Up marker, spawns to 2nd floor
{1825.17, -1299.39, 27.70, 255, 255, 0, 0, 1827.09, -1299.36, 33.16, 0, 0, 0}, -- 2nd floor Up marker, spawns to 3rd floor
{1825.17, -1299.39, 33.16, 255, 255, 0, 0, 1827.09, -1299.36, 38.62, 0, 0, 0}, -- 3rd floor Up marker, spawns to 4th floor
{1825.17, -1299.39, 38.62, 255, 255, 0, 0, 1827.09, -1299.36, 44.07, 0, 0, 0}, -- 4th floor Up marker, spawns to 5th floor
{1825.17, -1299.39, 44.09, 255, 255, 0, 0, 1827.09, -1299.36, 49.47, 0, 0, 0}, -- 5th floor Up marker, spawns to 6th floor
{1825.17, -1299.39, 49.47, 255, 255, 0, 0, 1827.09, -1299.36, 54.93, 0, 0, 0}, -- 6th floor Up marker, spawns to 7th floor
{1825.17, -1299.39, 54.93, 255, 255, 0, 0, 1827.09, -1299.36, 60.40, 0, 0, 0}, -- 7th floor Up marker, spawns to 8th floor
{1825.17, -1299.39, 60.40, 255, 255, 0, 0, 1827.09, -1299.36, 65.85, 0, 0, 0}, -- 8th floor Up marker, spawns to 9th floor
{1825.17, -1299.39, 65.85, 255, 255, 0, 0, 1827.09, -1299.36, 71.31, 0, 0, 0}, -- 9th floor Up marker, spawns to 10th floor
{1825.17, -1299.39, 71.31, 255, 255, 0, 0, 1827.09, -1299.36, 76.70, 0, 0, 0}, -- 10th floor Up marker, spawns to 11th floor
{1825.17, -1299.39, 76.70, 255, 255, 0, 0, 1827.09, -1299.36, 82.17, 0, 0, 0}, -- 11th floor Up marker, spawns to 12th floor
{1825.17, -1299.39, 82.17, 255, 255, 0, 0, 1827.09, -1299.36, 87.62, 0, 0, 0}, -- 12th floor Up marker, spawns to 13th floor
{1825.17, -1299.39, 87.62, 255, 255, 0, 0, 1827.09, -1299.36, 93.09, 0, 0, 0}, -- 13th floor Up marker, spawns to 14th floor
{1825.17, -1299.39, 93.09, 255, 255, 0, 0, 1827.09, -1299.36, 98.54, 0, 0, 0}, -- 14th floor Up marker, spawns to 15th floor
{1825.17, -1299.39, 98.54, 255, 255, 0, 0, 1827.09, -1299.36, 103.93, 0, 0, 0}, -- 15th floor Up marker, spawns to 16th floor
{1825.17, -1299.39, 103.93, 255, 255, 0, 0, 1827.09, -1299.36, 109.40, 0, 0, 0}, -- 16th floor Up marker, spawns to 17th floor
{1825.17, -1299.39, 109.30, 255, 255, 0, 0, 1827.09, -1299.36, 114.85, 0, 0, 0}, -- 17th floor Up marker, spawns to 18th floor
{1825.17, -1299.39, 114.85, 255, 255, 0, 0, 1827.09, -1299.36, 120.30, 0, 0, 0}, -- 18th floor Up marker, spawns to 19th floor
--[[ {1825.17, -1299.39, 120.30, 255, 255, 0, 0, 1827.09, -1299.36, } -- 19th floor Up marker, spawns to top of building --]]
}
function teleporter(hitElement, spawn)
local markerIndex = getElementData(source, "markerIndex")
local plrSkin = getElementModel(hitElement)
local rotation = markerTable[markerIndex][11]
local int = markerTable[markerIndex][12]
local dim = markerTable[markerIndex][13]
if (not getPedOccupiedVehicle(hitElement)) then
if (dim) then
setElementPosition (hitElement, markerTable[markerIndex][8], markerTable[markerIndex][9], markerTable[markerIndex][10])------ edited this
else
setElementPosition (hitElement, markerTable[markerIndex][8], markerTable[markerIndex][9], markerTable[markerIndex][10])------ this aswell
end
end
end
for i=1, #markerTable do
local x, y, z, r, g, b, dim = markerTable[i][1], markerTable[i][2], markerTable[i][3], markerTable[i][4], markerTable[i][5], markerTable[i][6], markerTable[i][7]
marker[i] = createMarker(x, y, z + 1, "arrow", 2, r, g, b, 200)
setElementDimension(marker[i], dim)
setElementData(marker[i], "markerIndex", i)
addEventHandler("onMarkerHit", marker[i], teleporter)
end
when the player has to 'Spawn' it has to re spawn bassically in small terms so setElementPosition sets the element in you x,y,z co-ords instead of respawning
Cheers
Arnold-1 was on the right track and same mind set as me