¡Hola, buen día, adjuntaré mi problema de manera detallada...!
Quiero cambiar el sonido del motor de la Wayfarer a una similitud con una Harley Davidson, por ello usé *getVehicleCurrentGear* cuando la moto esté parada reproduzca un sonido, si ya existe, no haga más, si acelera, cambie y elimine el que existía para evitar sonido acumulado pero soy principiante en creación de scripts, ¿Algún consejo?
function isSoundFinished(theSound)
return ( getSoundPosition(theSound) == getSoundLength(theSound) )
end
function HarleyDavidsonSound()
for _, vehicles in pairs(getElementsByType("vehicle")) do
if(getElementModel(vehicles) == 586) then
setWorldSoundEnabled( 7, 0, false)
setWorldSoundEnabled( 7, 1, false)
local x,y,z = getElementPosition( vehicles )
local gear = getVehicleCurrentGear( vehicles )
print(gear)
if gear == 1 then
motor = playSound3D("motor.wav", x, y, z, true)
attachElements( motor, vehicles)
setElementParent( motor, vehicles )
end
end
end
end
addEventHandler( "onClientRender", root, HarleyDavidsonSound)