valerr7 Posted March 22, 2020 Share Posted March 22, 2020 Hi! I just started doing codes, and I can't figure out how can I make the vehicle that i drive into the marker teleport to the middle of the marker and look in a direction, please countain explanation! The code: function onMarkerHit(hitPlayer, dim) if localPlayer == hitPlayer and getElementData(source, "marker") == true then if isPedInVehicle(localPlayer) then local veh = getPedOccupiedVehicle(localPlayer) local seat = getPedOccupiedVehicleSeat(localPlayer) if (veh) and seat == 0 then if getElementData(veh, "veh:owner") == getElementData(localPlayer, "acc:id") and getElementData(veh, "veh:id") > 0 or getElementData(localPlayer, "acc:admin") >= 7 then addEventHandler("onClientRender", root) setElementFrozen(veh, true) else outputChatBox("#D64541[Autóker]:#ffffff Ez a jármű nem a tiéd.", 255, 255, 255, true) end end end end end addEventHandler("onClientMarkerHit", getRootElement(), onMarkerHit) Link to comment
The_GTA Posted March 22, 2020 Share Posted March 22, 2020 14 minutes ago, valerr7 said: I can't figure out how can I make the vehicle that i drive into the marker teleport to the middle of the marker and look in a direction Hello valerr7, sorry but I cannot understand what you want exactly but I get that you want to change the position and rotation of the vehicle. Try using the setElementPosition and setElementRotation functions. For example in line 9: setElementPosition(veh, 0, 0, 0) setElementRotation(veh, 0, 0, 0) Link to comment
valerr7 Posted March 23, 2020 Author Share Posted March 23, 2020 Thanks! Thats what I needed! 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