Jump to content

Somebody can help me?


Yang

Recommended Posts

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

 

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 by Knuck
Link to comment

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 by Yang
Link to comment
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
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 by Dimos7
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...