RogerPizarro Posted July 27, 2020 Share Posted July 27, 2020 ¡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) Link to comment
Moderators IIYAMA Posted July 27, 2020 Moderators Share Posted July 27, 2020 @RogerPizarro Moved to here: https://forum.multitheftauto.com/forum/167-scripting/ Link to comment
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