Jump to content
  • 0

Ped no rotate in Z axis with attached


Z_ReC

Question

Hi, I'm Z_ReC and have a problem. :fadein:

Look at this Code :

Server Code:

addEventHandler("onResourceStart", getRootElement(), 
    function() 
        theCar = createVehicle(411, 0, 0, 3) 
        ped = createPed(299, 0,0,0) 
        misil = createObject(3790, 0, 0, 0) 
        attachElements(ped, theCar, 0, 0, 1.7) 
        attachElements(misil, theCar, 0, 0, 3, 0, 0, 270) 
    end) 

Get in the car, and drive.

As can be seen when running these lines, the PED created does not attached to the Z axis of rotation of the VEHICLE!

I wonder if there is a solution, or is it a bug of MTA!

Very VERY thanks for your time! I hope your answers :D (Sorry for my basic English, I'm say Spanish :lol: )

EDIT: View GIF demostration:

ki3c9xi.gif

Edited by Guest
Link to comment

1 answer to this question

Recommended Posts

  • 0

A solution (less than optimal) would be inserted into "onClientRender" the following code:

Server:

addEventHandler("onResourceStart", getRootElement(), 
        function() 
            theCar = createVehicle(411, 0, 0, 3) 
            addEventHandler("onVehicleEnter", root, 
                function(thePlayer) 
                    triggerClientEvent(thePlayer, "pedAttCar", source) 
                end) 
        end) 
  

Client:

addEvent("pedAttCar", true) 
addEventHandler("pedAttCar", root, 
    function() 
        local ped = createPed(299, 0,0,4) 
        local misil = createObject(3790, 0, 0, 0) 
        setElementCollisionsEnabled(ped,false) 
        attachElements(ped, source, 0, 0, 1.6) 
        attachElements(misil, source, 0, 0, 3, 0, 0, 270) 
        local theCar = source 
        addEventHandler("onClientRender", root, 
           function() 
               local _,_,rZ = getElementRotation(theCar) 
               setElementRotation(ped, 0, 0, rZ) 
           end 
        ) 
    end 
) 

Though it works, it would be better to do with the "attach" :mrgreen:

What do you think?

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