QoRaY Posted December 23, 2012 Posted December 23, 2012 I want to change the horn sound. How can I do this?
abu5lf Posted December 23, 2012 Posted December 23, 2012 bindKey playSound3D ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
QoRaY Posted December 23, 2012 Author Posted December 23, 2012 horn.wav "h" Can you do it? I do not understand. I know just a lua file to save. Lua Code Please.
Baseplate Posted December 23, 2012 Posted December 23, 2012 function playMySound() local x, y, z = getElementPosition(localPlayer) local sound = playSound3D ("horn.wav", x, y, z) end function stopMySound() local soundoff = stopSound(sound) end function bindTheKeys() unbindKey("h") bindKey("h", "down", playMySound) bindKey("h", "up", stopMySound) UNTESTED! And we don't do codes but we help only, I just did for you to learn
Baseplate Posted December 23, 2012 Posted December 23, 2012 (edited) Added the meta? Edited December 23, 2012 by Guest
abu5lf Posted December 23, 2012 Posted December 23, 2012 function playMySound() local x, y, z = getElementPosition(localPlayer) local sound = playSound3D ("horn.wav", x, y, z) end function stopMySound() local soundoff = stopSound(sound) end function bindTheKeys() unbindKey("h") bindKey("h", "down", playMySound) bindKey("h", "up", stopMySound) UNTESTED! And we don't do codes but we help only, I just did for you to learn Wrong! ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
manve1 Posted December 23, 2012 Posted December 23, 2012 function playMySound() local x, y, z = getElementPosition(localPlayer) local sound = playSound3D ("horn.wav", x, y, z) end function stopMySound() local soundoff = stopSound(sound) end function bindTheKeys() unbindKey("h") bindKey("h", "down", playMySound) bindKey("h", "up", stopMySound) end ((missed out 'end' )) Looking for tutorials or information? check out: www.simpleask.co.uk
QoRaY Posted December 23, 2012 Author Posted December 23, 2012 (edited) Does not work. Is there another code? Edited December 23, 2012 by Guest
abu5lf Posted December 23, 2012 Posted December 23, 2012 function bindHoron( key, keyState ) if isPedInVehicle( localPlayer ) then if ( keyState == 'down' ) then sound = playSound3D( 'horn.wav', getElementPosition( localPlayer ) ) attachElements( sound, getPedOccupiedVehicle( localPlayer ) ) elseif ( keyState == 'up' ) then if isElement( sound ) then stopSound( sound ) end end end end bindKey( 'h', 'down', bindHoron ) bindKey( 'h', 'up', bindHoron ) And you need disabled the control horn: toggleControl( 'horn', false ) ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
abu5lf Posted December 23, 2012 Posted December 23, 2012 You're welcome. ╔═╦╦╦╗╔╦═╦═╦═╦═╦╦╦╦╦╦╦═╦╦╦╦╗ ║║║║║╠╝║║╚╣║║║║║║║║║║║║║║║║║ ║║║║║╚╦╦═╦╦╦╦╣║║║║║║║║║║║║║║ ║║║║╠═╣╠╝╔══╝║║║║║╟╢║║║║║╟╢║ ╚╩══╩══╩═╩═══╩╩══╩╩═╩╩╩═╩╩═╝ «سبحانك اللهم وبحمدك أشهد أن لا إله إلا أنت أستغفرك وأتوب إليك» M7mdAl7arthy : لتواصل سكايب
QoRaY Posted December 23, 2012 Author Posted December 23, 2012 Is going to be one more question. Other people cannot hear. How can I fix?
manve1 Posted December 23, 2012 Posted December 23, 2012 trigger it to server side and back Looking for tutorials or information? check out: www.simpleask.co.uk
DeletedAccount1111 Posted December 23, 2012 Posted December 23, 2012 trigger it to server side and back Just in case, i think he means this
manve1 Posted December 23, 2012 Posted December 23, 2012 No, triggering isn't that .... And it wouldn't work if you done this. Read the tutorial i posted: viewtopic.php?f=148&t=51192 Looking for tutorials or information? check out: www.simpleask.co.uk
Ab-47 Posted December 24, 2012 Posted December 24, 2012 trigger it to server side and back Just in case, i think he means this How can there be a client script as type: server? I think he means: triggerServerEvent On the other hand, wouldn't binding a new sound collide with the existing GTA sounds? And now Aurora is back again, pm for more info. Ex. Lead dev & L6 Staff at AUR, NGC, MTA RP & SAA. Ex. Developer at Community of Social Gamers - CSG Ex Founder of International Gaming Community - IGC and Union of Individual Players- UIP Ab-47
Anderl Posted December 24, 2012 Posted December 24, 2012 trigger it to server side and back Just in case, i think he means this How can there be a client script as type: server? I think he means: triggerServerEvent On the other hand, wouldn't binding a new sound collide with the existing GTA sounds? He disabled horn control. "[...] If you don’t love it, if you’re not having fun doing it, you don’t really love it, you’re going to give up." - Steve Jobs, 2007
QoRaY Posted January 29, 2013 Author Posted January 29, 2013 Can not hear other players and at the sound is coming... Help?
mateplays Posted August 31, 2016 Posted August 31, 2016 There was no problems with this script... function playMySound() local x, y, z = getElementPosition(localPlayer) local sound = playSound3D ("horn.wav", x, y, z) end function stopMySound() local soundoff = stopSound(sound) end function bindTheKeys() unbindKey("h") bindKey("h", "down", playMySound) bindKey("h", "up", stopMySound) end addEventHandler("onClientResourceStart", resourceRoot, bindTheKeys) You just missed the EventHandler.
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