Hello, I am working on script for moving engine parts. I managed to make parts move but at the moment it is only turnable by command and I need help with script doing it somewhat automatically when engine is running. The vehicles are server-sided. I tried using https://wiki.multitheftauto.com/wiki/GetNearestVehicle but only thing I managed to get is error from getElementPosition,Interior and Dimension everytime when I tried localPlayer, player or thePlayer for some reason although I don't know if it would work when used on client-side with server-sided vehicles and probably needs something more to it. Thank you in advance for any reply.
(PS: Plz don't kill me for my naming conventions )
CLIENT
function epr()
local theVeh = getPedOccupiedVehicle(source)
if (theVeh) then
setTimer(function()
local rx, ry, rz = getVehicleComponentRotation(theVeh, "vetrak")
setVehicleComponentRotation(theVeh, "vetrak", rx-25, ry, rz)
local rx, ry, rz = getVehicleComponentRotation(theVeh, "kluka")
setVehicleComponentRotation(theVeh, "kluka", rx-25, ry, rz)
local rx, ry, rz = getVehicleComponentRotation(theVeh, "alternator")
setVehicleComponentRotation(theVeh, "alternator", rx-25, ry, rz)
end, 0, 0)
end
end
addEvent("epr", true)
addEventHandler("epr", root, epr)
SERVER
function epr( thePlayer, commandName )
triggerClientEvent (thePlayer,"epr",thePlayer)
end
addCommandHandler ("epr", epr)