Jump to content

[LUA] Marker teleporting into interior


Recommended Posts

This is my first time posting

I have this script that teleports you into Jefferson Motel when you hit the marker. I have it working when you go inside the motel, however if you try to walk outside, the marker doesn't do anything. Almost as if there is no script telling you to go outside.

This is my script.

function motel(player)
    if (source == motelOutside and getElementType(player) == "player") then
        setElementInterior(player, 15, 2216,-1150.5,1025)
        setElementFrozen(player,false)
        setTimer(setElementFrozen, 1000, 1, player, false)
        outputChatBox("Entering the motel...", player)
    elseif (source == motelInside and getElementType(player) == "player") then
        setElementInterior(player, 0, spawnX,spawnY,spawnZ)
        setElementFrozen(player,false)
        setTimer(setElementFrozen, 1000, 1, player, false)
    end
end
	addEventHandler("onMarkerHit", root, motel)
Edited by ReeferMadness
codebox
Link to comment
26 minutes ago, ReeferMadness said:

This is my first time posting

I have this script that teleports you into Jefferson Motel when you hit the marker. I have it working when you go inside the motel, however if you try to walk outside, the marker doesn't do anything. Almost as if there is no script telling you to go outside.

This is my script.


function motel(player)
    if (source == motelOutside and getElementType(player) == "player") then
        setElementInterior(player, 15, 2216,-1150.5,1025)
        setElementFrozen(player,false)
        setTimer(setElementFrozen, 1000, 1, player, false)
        outputChatBox("Entering the motel...", player)
    elseif (source == motelInside and getElementType(player) == "player") then
        setElementInterior(player, 0, spawnX,spawnY,spawnZ)
        setElementFrozen(player,false)
        setTimer(setElementFrozen, 1000, 1, player, false)
    end
end
	addEventHandler("onMarkerHit", root, motel)
 

Please post your entire used script, as we need to know more than your function, how are the markers made?

Link to comment
8 hours ago, Mr.Pres[T]ege said:

If you can upload the script in here so i can check it.

	--MARKERS
motelOutside = createMarker( 2333.5, -1943.5, 14, "cylinder", 1, 255, 255, 0, 170 )
motelInside = createMarker( 2215, -1150.5, 1024.5, "cylinder", 1, 255, 255, 0, 170 )
setElementInterior(motelInside, 15, 2215, -1150.5, 1024)

function motel(player)
    if (source == motelOutside and getElementType(player) == "player") then
        setElementInterior(player, 15, 2216,-1150.5,1025)
        setElementFrozen(player,false)
        setTimer(setElementFrozen, 1000, 1, player, false)
        outputChatBox("Entering the motel...", player)
    elseif (source == motelInside and getElementType(player) == "player") then
        setElementInterior(player, 0, spawnX,spawnY,spawnZ)
        setElementFrozen(player,false)
        setTimer(setElementFrozen, 1000, 1, player, false)
    end
end

addEventHandler("onMarkerHit", root, motel)
Edited by ReeferMadness
Link to comment
5 minutes ago, Mr.Pres[T]ege said:

Yes can you please post your meta.xml file so i can check if there's something wrong.

I dont have the meta.xml on me right now but I know it was working because the teleport script was part of one big server script that had other commands I wrote that were also working

Link to comment

Try this

local motelOutside = createMarker( 2333.5, -1943.5, 15, "cylinder", 1, 255, 255, 0, 170 )
local motelInside = createMarker( 2215, -1150.5, 1025, "cylinder", 1, 255, 255, 0, 170 )
setElementInterior(motelInside, 15)

function motel(player)
    if player and isElement(player) and getElementType(player) == "player" and not isPedInVehicle(player) then
        if (source == motelOutside) then
            setElementInterior(player, 15, 2216,-1150.5,1025)
            setElementFrozen(player,true)
            setTimer(setElementFrozen, 1000, 1, player, false)
        elseif (source == motelInside) then
            setElementInterior(player, 0, 2335, -1943.5, 15)
            setElementFrozen(player,true)
            setTimer(setElementFrozen, 1000, 1, player, false)
        end 
    end
end
addEventHandler("onMarkerHit", root, motel)

 

Edited by Walid
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...