created zipfile, refresh in server consule, enterh resource loaded, BUT staying on marker there are no debug and nothing happens !!!
enterh folder
my meta.xml
<meta>
<script src="enterh_c.lua" type="client"/>
</meta>
my enterh_c.lua
function tryToTeleport()
outputDebugString("pressed enter_exit")
local veh = getPedOccupiedVehicle(getLocalPlayer())
if veh then outputDebugString("in vehicle - cant teleport") return false end
local tx=tonumber(getElementData(current, "TposX"))
local ty=tonumber(getElementData(current, "TposY"))
local tz=tonumber(getElementData(current, "TposZ"))
local ti=tonumber(getElementData(current, "Tinterior"))
local td=tonumber(getElementData(current, "Tdimension"))
if (tx and ty and tz and ti and td) then
setElementPosition(getLocalPlayer(),tx,ty,tz)
setElementDimension(getLocalPlayer(), td)
setElementInterior(getLocalPlayer(), ti)
outputDebugString("teleported")
return true -- the rest will not run
end
outputDebugString("failed to teleport - something wrong with marker in map file")
end
local keys = getBoundKeys('enter_exit')
for key, state in pairs(keys) do
outputDebugString("bound key: "..key)
bindKey(key, "up", tryToTeleport)
end
current = nil
function disableCurrentMarker(hitElement, matchingDimension)
outputDebugString("something left the marker")
if (matchingDimension and hitElement==getLocalPlayer()) then
outputDebugString("you left the marker")
current = nil
end
end
function setAsCurrentMarker(hitElement, matchingDimension)
outputDebugString("something hit the marker")
if (matchingDimension and hitElement==getLocalPlayer()) then
outputDebugString("you hit the marker")
current = source
end
end
local markers = getElementsByType("marker", getResourceRootElement(getThisResource()))
local i = 1
outputDebugString("Markers count: "..#markers)
for key, val in ipairs(markers) do
local atype = getElementData(val, "atype")
if (atype=="teleport") then
outputDebugString("Found marker: "..i)
i=i+1
addEventHandler("onClientMarkerHit", val, setAsCurrentMarker)
addEventHandler("onClientMarkerLeave", val, disableCurrentMarker)
end
end
enterhmaps folder
meta.xml
<meta>
<map src="enterh.map" dimension="0" />
</meta>
enterh.map
<map>
<marker posX="1482" posY="-1734.94" posZ="13" interior="0" dimension="0" type="cylinder" size="3" color="#ffffff" atype="teleport" TposX="1487.06" TposY="-1735.05" TposZ="13.38" Tinterior="0" Tdimension="0" />
</map>
link to zip files http://www.failiem.lv/list.php?i=tsgopd
meiby i need server side script too?