Z_ReC Posted July 9, 2015 Posted July 9, 2015 (edited) Hi, I'm Z_ReC and have a problem. 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 (Sorry for my basic English, I'm say Spanish ) EDIT: View GIF demostration: Edited July 9, 2015 by Guest Bed goes up, Bed goes down. Bed goes up, Bed goes down. Bed goes up, Bed goes down. Bed goes up, Bed goes down.
0 Z_ReC Posted July 9, 2015 Author Posted July 9, 2015 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" What do you think? Bed goes up, Bed goes down. Bed goes up, Bed goes down. Bed goes up, Bed goes down. Bed goes up, Bed goes down.
Question
Z_ReC
Hi, I'm Z_ReC and have a problem.
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
(Sorry for my basic English, I'm say Spanish
)
EDIT: View GIF demostration:

Edited by GuestBed goes up, Bed goes down. Bed goes up, Bed goes down. Bed goes up, Bed goes down. Bed goes up, Bed goes down.
1 answer to this question
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