Jump to content

[HELP] Setting a car in a position


valerr7

Recommended Posts

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(hitPlayerdim)
    if localPlayer == hitPlayer and getElementData(source, "marker"== true then
        if isPedInVehicle(localPlayerthen
            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."255255255true)
                end
            end
        end
    end
end
addEventHandler("onClientMarkerHit"getRootElement(), onMarkerHit)
Link to comment
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

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