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?