Yang Posted October 12, 2018 Share Posted October 12, 2018 I want to make a script to teleport the player between 2 checkpoints, but I can't keep the Z position, this is my script, Pleaseee Hellllpppp local myMarker1 = createMarker(1, 1, 1, 'checkpoint', 2.0, 255, 0, 0, 150) -- create myMarker local myMarker2 = createMarker(1,10,3, 'checkpoint', 2.0, 255, 0, 0, 150) local x,y,z = getElementPosition( source ) function Entrada (source) setElementPosition ( source, 1,15,z ) end function Salida (source) setElementPosition ( source, 1, -5, z ) end addEventHandler( "onMarkerHit", myMarker1, Entrada ) addEventHandler( "onMarkerHit", myMarker2, Salida ) Link to comment
VenomOG Posted October 12, 2018 Share Posted October 12, 2018 (edited) local myMarker = createMarker( -2596.6259765625, 579.3583984375, 15.626741409302, 'cylinder', 2.0, 255, 0, 0, 150 ) local myMarker2 = createMarker( -2596.6259765625, 579.3583984375, 15.626741409302, 'cylinder', 2.0, 255, 0, 0, 150 ) function MarkerHit( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, posX, posY, posZ ) end function MarkerHit2( hitPlayer, matchingDimension ) setElementPosition ( hitPlayer, posX, posY, posZ ) end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) addEventHandler( "onMarkerHit", myMarker2, MarkerHit ) @Yang Edited October 12, 2018 by Knuck Link to comment
Yang Posted October 12, 2018 Author Share Posted October 12, 2018 (edited) Thanks but the script doesnThanks but the script doesn't work, I need to teleport a source keeping the vector Z and modify the others, the idea is to create a wall at the end of the map that teleports to a player to the other limits of the map, like a 2d game, when the player arrives at the limit and is teleported to the other side of the same map the problem is when a plane uses the checkpoint is teleported to the same position and the plane sinks. That's why I want to keep its vector Z Edited October 12, 2018 by Yang Link to comment
MrKAREEM Posted October 12, 2018 Share Posted October 12, 2018 9 hours ago, Yang said: Thanks but the script doesnThanks but the script doesn't work, I need to teleport a source keeping the vector Z and modify the others, the idea is to create a wall at the end of the map that teleports to a player to the other limits of the map, like a 2d game, when the player arrives at the limit and is teleported to the other side of the same map the problem is when a plane uses the checkpoint is teleported to the same position and the plane sinks. That's why I want to keep its vector Z what about get Plane (Z) Position and set ped position (Z) of the plane ?? Link to comment
Yang Posted October 12, 2018 Author Share Posted October 12, 2018 To keep the plane flying, because the other way the plane is teleported tocking the sea, Link to comment
MrKAREEM Posted October 12, 2018 Share Posted October 12, 2018 11 minutes ago, Yang said: To keep the plane flying, because the other way the plane is teleported tocking the sea, am not understand u correctly u want now warp ped to plane or whats the problem i dont know Link to comment
Dimos7 Posted October 12, 2018 Share Posted October 12, 2018 (edited) local myMarker = createMarker( -2596.6259765625, 579.3583984375, 15.626741409302, 'cylinder', 2.0, 255, 0, 0, 150 ) local myMarker2 = createMarker( -2596.6259765625, 579.3583984375, 15.626741409302, 'cylinder', 2.0, 255, 0, 0, 150 ) function MarkerHit( hitPlayer, matchingDimension ) if isPedInVehicle(hitPlayer) then local veh =getPedOccupiedVehicle(hitPlayer) setElementPosition ( veh, posX, posY, posZ ) warpPedIntoVehicle(hitPlayer, veh) end end function MarkerHit2( hitPlayer, matchingDimension ) if isPedInVehicle(hitPlayer) then local veh = getPedOccupiedVehicle(hitPlayer) setElementPosition ( veh, posX, posY, posZ ) warpPedIntoVehicle(Hot Player, veh) end end addEventHandler( "onMarkerHit", myMarker, MarkerHit ) addEventHandler( "onMarkerHit", myMarker2, MarkerHit ) Edited October 12, 2018 by Dimos7 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