ReeferMadness Posted October 3, 2016 Share Posted October 3, 2016 (edited) 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 October 3, 2016 by ReeferMadness codebox Link to comment
Dealman Posted October 3, 2016 Share Posted October 3, 2016 Have you tried to use setElementInterior on the marker? So it's within the same interior as the player? Link to comment
AJXB Posted October 3, 2016 Share Posted October 3, 2016 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
ReeferMadness Posted October 3, 2016 Author Share Posted October 3, 2016 --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) Link to comment
iPrestege Posted October 3, 2016 Share Posted October 3, 2016 setElementInterior ( motelInside,15 ) Link to comment
ReeferMadness Posted October 3, 2016 Author Share Posted October 3, 2016 Just now, Mr.Pres[T]ege said: setElementInterior ( motelInside,15 ) I replaced this (took out coordinates x,y,z) and still running into the same issue Link to comment
iPrestege Posted October 3, 2016 Share Posted October 3, 2016 Can you please tell me what the debug say Link to comment
ReeferMadness Posted October 3, 2016 Author Share Posted October 3, 2016 6 hours ago, Mr.Pres[T]ege said: Can you please tell me what the debug say I dont get a message in the console from debug Link to comment
iPrestege Posted October 4, 2016 Share Posted October 4, 2016 If you can upload the script in here so i can check it. Link to comment
Dealman Posted October 4, 2016 Share Posted October 4, 2016 Have you tried moving the marker a bit? For example try and move it up a little bit? Or to the left/right, maybe it's in some awkward position where it can't register the event. Link to comment
ReeferMadness Posted October 4, 2016 Author Share Posted October 4, 2016 (edited) 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 October 4, 2016 by ReeferMadness Link to comment
iPrestege Posted October 4, 2016 Share Posted October 4, 2016 I just test it and works fine just put your 'spawnX,spawnY,spawnZ' Position and it will work and make sure it's server side in meta.xml file! Link to comment
ReeferMadness Posted October 4, 2016 Author Share Posted October 4, 2016 5 hours ago, Mr.Pres[T]ege said: I just test it and works fine just put your 'spawnX,spawnY,spawnZ' Position and it will work and make sure it's server side in meta.xml file! Hmmm.. can you go both in and out? Link to comment
iPrestege Posted October 4, 2016 Share Posted October 4, 2016 Yes can you please post your meta.xml file so i can check if there's something wrong. Link to comment
ReeferMadness Posted October 4, 2016 Author Share Posted October 4, 2016 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
iPrestege Posted October 4, 2016 Share Posted October 4, 2016 Then nothing i can do for you in the moment i checked the script and it was working perfectly. Link to comment
ReeferMadness Posted October 4, 2016 Author Share Posted October 4, 2016 50 minutes ago, Mr.Pres[T]ege said: Then nothing i can do for you in the moment i checked the script and it was working perfectly. Im going to try reinstalling mta Link to comment
Dealman Posted October 4, 2016 Share Posted October 4, 2016 I just tried it as well, it didn't work for me either - so I tried moving the inside marker up by 1 unit and after that it was working. Weird Link to comment
Walid Posted October 4, 2016 Share Posted October 4, 2016 (edited) 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 October 4, 2016 by Walid Link to comment
ReeferMadness Posted October 5, 2016 Author Share Posted October 5, 2016 Turns out that the marker was slightly submerged into the floor. Its working perfectly now thanks everyone in this forum topic! Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now