DYNAMO Posted July 29, 2013 Share Posted July 29, 2013 Can anyone send me the lua code for making a teleporter , which works only on human. Link to comment
Castillo Posted July 29, 2013 Share Posted July 29, 2013 createMarker -- Creates a marker. getElementType -- Check element type. setElementPosition -- Sets an element position. onMarkerHit Link to comment
LucasBaker Posted July 29, 2013 Share Posted July 29, 2013 local myMarker = createMarker(x, y, z, 'cylinder', 2.0, 255, 0, 0, 150) function MarkerHit( hitElement, matchingDimension ) local elementType = getElementType( hitElement ) outputChatBox( elementType.." Teleported", getRootElement(), 255, 255, 0 ) setElementPosition ( source, x, y, z ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) not tested Link to comment
DYNAMO Posted July 31, 2013 Author Share Posted July 31, 2013 this not working , only chatbox works but not teleporting. local myMarker = createMarker(-3481.140625, 826.65930175781, 113.88046264648, 'cylinder', 2.0, 25, 1, 1, 90) function MarkerHit( hitElement, matchingDimension ) local elementType = getElementType( hitElement ) outputChatBox( elementType.." Teleported", getRootElement(), 255, 255, 0 ) setElementPosition ( source, 238.24238586426, 139.32133483887,1003.0234375) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) Link to comment
aim-killer Posted July 31, 2013 Share Posted July 31, 2013 or u can use onPlayerMarkerHit which is triggered when a player hits a marker try this : -- server side teleportmaker = createMarker(2034.5029296875, 1545.4658203125, 9.5, 'cylinder', 2.0, 25, 1, 1, 90) function teleport( markerHit, matchingDimension ) if markerHit == teleportmaker and matchingDimension then -- if the marker hit by player is teleportmarker and same dimension player = source playername = getPlayerName(player) outputChatBox( playername.." has teleported", getRootElement(), 255, 255, 0 ) setElementPosition ( player, 2495.4013671875, -1681.9228515625, 13.338929176331) end end addEventHandler( "onPlayerMarkerHit", getRootElement(), teleport ) Link to comment
DYNAMO Posted July 31, 2013 Author Share Posted July 31, 2013 teleportmaker = createMarker(-3480.7614746094, 826.58349609375, 113.88046264648, 'cylinder', 2.0, 25, 1, 1, 90) function teleport( markerHit, matchingDimension ) if markerHit == teleportmaker and matchingDimension then player = source playername = getPlayerName(player) outputChatBox( playername.." has teleported", getRootElement(), 255, 255, 0 ) setElementPosition ( player, 239.24244689941, 141.27333068848, 1003.0234375) end end addEventHandler( "onPlayerMarkerHit", getRootElement(), teleport ) I tried this but I want to teleport to a interior which dimension I have set , but when teleported to that teleporter ,it teleports their but interior don't comes. I teleported to air. Link to comment
iMr.3a[Z]eF Posted July 31, 2013 Share Posted July 31, 2013 Here you are, change the interior to whatever you wanted: local teleportmaker = createMarker(-3480.7614746094, 826.58349609375, 113.88046264648, 'cylinder', 2.0, 25, 1, 1, 90) function teleport( markerHit ) if getElementType(markerHit) == "player" then playername = getPlayerName(markerHit) outputChatBox( playername.." has teleported", getRootElement(), 255, 255, 0 ) setElementPosition ( markerHit, 239.24244689941, 141.27333068848, 1003.0234375) setElementInterior ( markerHit, 1 ) end end addEventHandler( "onMarkerHit", getRootElement(), teleport ) Link to comment
DYNAMO Posted July 31, 2013 Author Share Posted July 31, 2013 what if I want to teleport to HVPD HQ.? Link to comment
DYNAMO Posted July 31, 2013 Author Share Posted July 31, 2013 I am not understanding , so please write a script to teleport to LVPD HQ Link to comment
Castillo Posted July 31, 2013 Share Posted July 31, 2013 This is not a request forum, make it yourself. 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