Jump to content

How to make two teleport markers


TuRisMo

Recommended Posts

This is the code i made for teleport

marker = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153) 
                      
function teleport(player) 
if getElementType(player)=="player" then 
local vehicle=getPedOccupiedVehicle(player) 
if source == marker then 
setElementPosition(player, -354.3, -3786.8000976563, 16.40000038147) 
setElementFrozen(player, false) 
setTimer(setElementFrozen, 1000, 1, player, false) 
end 
end 
end 
addEventHandler("onClientMarkerHit", getRootElement(), teleport) 

how to make two different markers cuz when i make coppy to this code and paste again and change locations, id doesn't work

plz give me the right code and Thx

Link to comment

server side

marker1 = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153) 
  
                      
function teleport1(player) 
if getElementType(player)=="player" then 
local vehicle=getPedOccupiedVehicle(player) 
setElementPosition(player, -354.3, -3786.8000976563, 16.40000038147) 
setElementFrozen(player, false) 
setTimer(setElementFrozen, 1000, 1, player, false) 
end 
end 
addEventHandler("onMarkerHit", marker1, teleport1) 
  
marker2 = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153) 
function teleport2(player) 
if getElementType(player)=="player" then 
local vehicle=getPedOccupiedVehicle(player) 
setElementPosition(player, -354.3, -3786.8000976563, 16.40000038147) 
setElementFrozen(player, false) 
setTimer(setElementFrozen, 1000, 1, player, false) 
end 
end 
  
addEventHandler("onMarkerHit", marker2, teleport2) 

Link to comment
marker1 = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153) 
                      
function Hit1 ( hitElement, matchingDimension ) 
local Type = getElementType( hitElement ) 
local vehicle=getPedOccupiedVehicle(source) 
setElementPosition(Type, -354.3, -3786.8000976563, 16.40000038147) 
setElementFrozen(Type, false) 
setTimer(setElementFrozen, 1000, 1, Type, false) 
end 
end 
end 
addEventHandler("onMarkerHit", marker1, Hit1) 
  
marker2 = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153) 
  
function Hit2 ( hitElement, matchingDimension ) 
local Type = getElementType( hitElement ) 
local vehicle=getPedOccupiedVehicle(source) 
setElementPosition(Type, -354.3, -3786.8000976563, 16.40000038147) 
setElementFrozen(Type, false) 
setTimer(setElementFrozen, 1000, 1, Type, false) 
end 
end 
  
addEventHandler("onMarkerHit", marker2, Hit2) 

Link to comment
marker1 = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153) 
marker2 = createMarker(934, -1452, 14.5, "arrow", 1.5, 230, 251, 3, 153)  
  
function teleport(player) 
    if (source == marker1 and getElementType(player) == "player") then 
        setElementPosition(player, -354.3, -3786.8000976563, 16.40000038147) 
        setElementFrozen(player, false) 
        setTimer(setElementFrozen, 1000, 1, player, false) 
    elseif (source == marker2 and getElementType(player) == "player") then 
        setElementPosition(player, -354.3, -3786.8000976563, 16.40000038147) 
        setElementFrozen(player, false) 
        setTimer(setElementFrozen, 1000, 1, player, false)   
    end 
end 
addEventHandler("onMarkerHit", root, teleport) 

@Evil: You're trying to set position of a string? nice one.

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...