Jump to content

[HELP ] TP vehcile through marker


Ekko

Recommended Posts

Hello this script wont work it just create the marker and wont tp the vehicle pls fix it for me 

marker = createMarker(1217.0947265625, 357.6181640625, 19.413511276245, "corona", 3.5, 255, 255, 0, 255)

function teleport(player)
if getElementType(player)=="player" then
local vehicle=getPedOccupiedVehicle(player)
if source == marker then
       local pTeam = getPlayerTeam(thePlayer) 
    if getTeamName(pTeam) == "Police" then
setElementPosition(vehicle, 1270.8095703125, 333.9189453125, 19.40625, true)
setElementFrozen(vehicle, true)
setTimer(setElementFrozen, 1000, 1, vehicle, false)
end
end
end
addEventHandler("onClientMarkerHit", getRootElement(), teleport) 

 

Link to comment

I fixed the tp but the script  doesn't work when i add those two lanes 

 local pTeam = getPlayerTeam(player) 
    if getTeamName(pTeam) == "police" then

it work when i use only this pls help

marker = createMarker(1220.44140625, 354.8740234375, 18.40625, "corona", 1.5, 255, 255, 0, 255)

function teleport(player)
if getElementType(player)=="player" then
local vehicle=getPedOccupiedVehicle(player)
if source == marker then

fadeCamera(player, false)
setTimer( fadeCamera, 1000, 1, player, true)
setTimer(setElementInterior, 1000, 1, vehicle, 0)
setTimer(setElementPosition, 1000, 1, vehicle, 1277.8544921875, 332.865234375, 19.40625, true)
setElementFrozen(vehicle, true)
setTimer(setElementFrozen, 1000, 1, vehicle, false)
end
end
end
addEventHandler("onMarkerHit", getRootElement(), teleport) 

 

Edited by Ekko
Link to comment
marker = createMarker(1220.44140625, 354.8740234375, 18.40625, "corona", 1.5, 255, 255, 0, 255)

function teleport(player)
if isElement(player) and getElementType(player)=="player" then
local vehicle=getPedOccupiedVehicle(player)
if source == marker then
if getTeamName(getPlayerTeam(player)) == "police" then
fadeCamera(player, false)
setTimer( fadeCamera, 1000, 1, player, true)
setTimer(setElementInterior, 1000, 1, vehicle, 0)
setTimer(setElementPosition, 1000, 1, vehicle, 1277.8544921875, 332.865234375, 19.40625, true)
setElementFrozen(vehicle, true)
setTimer(setElementFrozen, 1000, 1, vehicle, false)
        end 
end
end
end
addEventHandler("onMarkerHit", root , teleport) 

Make sure the name of team is police with lower not p upper

Link to comment
1 hour ago, Dimos7 said:

marker = createMarker(1220.44140625, 354.8740234375, 18.40625, "corona", 1.5, 255, 255, 0, 255)

function teleport(player)
if isElement(player) and getElementType(player)=="player" then
local vehicle=getPedOccupiedVehicle(player)
if source == marker then
if getTeamName(getPlayerTeam(player)) == "police" then
fadeCamera(player, false)
setTimer( fadeCamera, 1000, 1, player, true)
setTimer(setElementInterior, 1000, 1, vehicle, 0)
setTimer(setElementPosition, 1000, 1, vehicle, 1277.8544921875, 332.865234375, 19.40625, true)
setElementFrozen(vehicle, true)
setTimer(setElementFrozen, 1000, 1, vehicle, false)
        end 
end
end
end
addEventHandler("onMarkerHit", root , teleport) 


Make sure the name of team is police with lower not p upper

Didn't work bro the maker dont show up on the map !! :/

Link to comment
marker = {}
marker[1] = createMarker(1217.0947265625, 357.6181640625, 19.413511276245, "corona", 3.5, 255, 255, 0, 255)

function TelePort(Element)  
setElementPosition(Element, 1270.8095703125, 333.9189453125, 19.40625, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'police' then TelePort(vehicle) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 

Try .. Server-only

Link to comment
14 hours ago, #\_oskar_/# said:

marker = {}
marker[1] = createMarker(1217.0947265625, 357.6181640625, 19.413511276245, "corona", 3.5, 255, 255, 0, 255)

function TelePort(Element)  
setElementPosition(Element, 1270.8095703125, 333.9189453125, 19.40625, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'police' then TelePort(vehicle) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 


Try .. Server-only

i want to tp inside interior (diffirente dimension/interior ) pls help me 

Link to comment
marker = {}
marker[1] = createMarker(1217.0947265625, 357.6181640625, 19.413511276245, "corona", 3.5, 255, 255, 0, 255)

function TelePort(Element, hitElement )  
setElementInterior(Element, 1)
setElementDimension (Element, 36 )
setTimer(setElementInterior, 1000, 1, Element, 1)
setTimer(setElementInterior, 1000, 1, player, 1)
setElementPosition(Element, 1099.146484375, -1300.3564453125, 79.0625, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'Gendarmerie Royale' then TelePort(vehicle) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 

With this the car TP to the right place (interior: 1 /dimenson: 36 ) but the player tp to interior : 0 / dimensen : 36 pls help 

Link to comment
marker = {}
marker[1] = createMarker(1217.0947265625, 357.6181640625, 19.413511276245, "corona", 3.5, 255, 255, 0, 255)

function TelePort(Element, hitElement)
setElementInterior(Element, 1)
setElementDimension (Element, 36 )
setTimer(setElementInterior, 1000, 1, Element, 1)
setTimer(setElementInterior, 1000, 1, hitElement, 1)
setElementPosition(Element, 1099.146484375, -1300.3564453125, 79.0625, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'Gendarmerie Royale' then TelePort(vehicle, player) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 

Try this 

Edited by Dimos7
Link to comment
16 hours ago, Dimos7 said:

marker = {}
marker[1] = createMarker(1217.0947265625, 357.6181640625, 19.413511276245, "corona", 3.5, 255, 255, 0, 255)

function TelePort(Element, hitElement)
setElementInterior(Element, 1)
setElementDimension (Element, 36 )
setTimer(setElementInterior, 1000, 1, Element, 1)
setTimer(setElementInterior, 1000, 1, hitElement, 1)
setElementPosition(Element, 1099.146484375, -1300.3564453125, 79.0625, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'Gendarmerie Royale' then TelePort(vehicle, player) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 


Try this 

You are the man tnx alot works good :D

Link to comment
14 minutes ago, Dimos7 said:

np

marker = {}
marker[1] = createMarker(1075.7607421875, -1287.2705078125, 79.064178466797, "corona", 3.5, 255, 255, 0, 255)
setElementInterior(marker[1], 1)
setElementDimension (marker[1], 36 )
function TelePort(Element, hitElement)
setElementInterior(Element, 0)
setElementDimension (Element, 0 )
setTimer(setElementInterior, 10, 1, Element, 0)
setTimer(setElementInterior, 10, 1, hitElement, 0)
setElementPosition(Element, 1230.5107421875, 302.2041015625, 19.619340896606, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'Gendarmerie Royale' then TelePort(vehicle, player) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 

Hey sorry for asking to much :D i'm trying to do the opposite , tp from interior to outside i modified the code : the car tp well to the dimension 0 , interior 0 but the player tp to the dimensen 0 , interior 1 . help pls

Link to comment
marker = {}
marker[1] = createMarker(1075.7607421875, -1287.2705078125, 79.064178466797, "corona", 3.5, 255, 255, 0, 255)
setElementInterior(marker[1], 1)
setElementDimension (marker[1], 36 )
function TelePort(Element, hitElement)
setElementInterior(Element, 0)
setElementDimension (Element, 0)
setElementDimension(hitElement, 0)
setTimer(setElementInterior, 10, 1, Element, 0)
setTimer(setElementInterior, 10, 1, hitElement, 0)
setElementPosition(Element, 1230.5107421875, 302.2041015625, 19.619340896606, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'Gendarmerie Royale' then TelePort(vehicle, player) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 

hmm i see dimension of player not be in code so i dd it

Link to comment
3 minutes ago, Dimos7 said:

marker = {}
marker[1] = createMarker(1075.7607421875, -1287.2705078125, 79.064178466797, "corona", 3.5, 255, 255, 0, 255)
setElementInterior(marker[1], 1)
setElementDimension (marker[1], 36 )
function TelePort(Element, hitElement)
setElementInterior(Element, 0)
setElementDimension (Element, 0)
setElementDimension(hitElement, 0)
setTimer(setElementInterior, 10, 1, Element, 0)
setTimer(setElementInterior, 10, 1, hitElement, 0)
setElementPosition(Element, 1230.5107421875, 302.2041015625, 19.619340896606, true)
setElementFrozen(Element, true)
setTimer(setElementFrozen, 1000, 1,Element, false)
end
addEventHandler("onMarkerHit",marker[1], function (player)  
if getElementType(player)=="player" then
local vehicle = getPedOccupiedVehicle(player)
if vehicle then 
local pTeam = getPlayerTeam(player)
if pTeam and getTeamName(pTeam) == 'Gendarmerie Royale' then TelePort(vehicle, player) return end  
outputChatBox ('You are not in a team',player, 255, 0, 0 ) 
else
outputChatBox ('You do not have a Vehicle!',player, 255, 0, 0 ) 
end 
end 
end) 

hmm i see dimension of player not be in code so i dd it

thanks so much i changed the lane that you added from setElementDimension(hitElement, 0)  to setElementInterior(hitElement, 0) worked good 

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