Dekonpriv Posted March 24, 2023 Share Posted March 24, 2023 I wold like to create a marker that teleports the player to a location the vehicle to another location. The marker, I already know how to create it Link to comment
FLUSHBICEPS Posted March 25, 2023 Share Posted March 25, 2023 - Create a marker at the desired location using the createMarker function - Use addEventHandler to create an event handler function that will be called when the marker is triggered - Use the setElementPosition function in the event handler function to move the player and vehicle to the desired location Link to comment
Hydra Posted March 25, 2023 Share Posted March 25, 2023 (edited) local myMarker = createMarker(...) addEventHandler("onClientMarkerHit", myMarker, function(hit, dim) local vehicle = getPedOccupiedVehicle(localPlayer) if hit == localPlayer or hit == vehicle then if vehicle then setElementPosition(vehicle, x, y, z) setElementPosition(localPlayer, x, y, z) else setElementPosition(localPlayer, x, y, z) end end end) Edited March 25, 2023 by Hydra Link to comment
AngelAlpha Posted March 25, 2023 Share Posted March 25, 2023 19 hours ago, Dekonpriv said: I wold like to create a marker that teleports the player to a location the vehicle to another location. The marker, I already know how to create it local marker = createMarker (...) addEventHandler ("onMarkerHit", marker, function(el, dim) if not dim then return end if getElementType(el) ~= "player" then return end local veh = getPedOccupiedVehicle (el) if veh then if getVehicleOccupant(veh) ~= el then return end setElementPosition (veh, x, y, z) else setElementPosition (el, x, y, z) end end) 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