DzMGZXL Posted December 13, 2014 Share Posted December 13, 2014 So i want make when player write /handbrake in CAR it play sound.Maybe anybody can help? Link to comment
myonlake Posted December 13, 2014 Share Posted December 13, 2014 Hey, Welcome to Multi Theft Auto, I hope you enjoy your stay here. In order to learn to script in Lua scripting language, I suggest you take some time to find the following topic useful for yourself. It contains links to tutorials and information regarding the use of the language in practice. This is essential in order to learn the basics of Lua and then work on your Multi Theft Auto related scripts. » Lua tutorials, manuals After you have familiarized yourself with Lua and know how to deploy basic code with it, you may move on to Multi Theft Auto specific scripting. Up-to-date Multi Theft Auto scripting information, details and help can be found on the Multi Theft Auto Wiki site. Get yourself familiarized with the scripting features Multi Theft Auto offers you by reading articles of which links you can find on the right side of the Wiki front page under the Scripting heading: » Server Manual » Introduction to scripting » Introduction to scripting the GUI » Debugging Tutorial » Introduction to resources» meta.xml » ACL You might also find the Tutorials board useful. These are tutorials, manuals and help topics written by community members. If Wiki seems a little bit too hardcore for you at the moment, checking this board should get you started easily. Feel free to also use our available chatting channels to ask questions and get help in general. These can be found at the IRC Channel Wiki article. Make sure to search for an answer on your preferred search engine first, and through the forum search feature. This way you can find solutions faster and will keep our channels clean of already answered questions! If you have code which you can post on your topic, that would make it easier for helpers to get a solution for you faster. Keep in mind that we are a public forum and we can only fix your code if you are willing to post it on your topic. This way we give you help and eventually a solution, and if someone else is facing the same issue later they can find a solution to the problem from your topic. I hope this got you started up! Link to comment
Buffalo Posted December 13, 2014 Share Posted December 13, 2014 Well it kinda has some work to do. You have to add sound to meta.xml so it will be downloaded. Then you can play it on client side using playSound Link to comment
ChaosMTA Posted December 13, 2014 Share Posted December 13, 2014 addCommandHandler playSound3D Link to comment
manawydan Posted December 13, 2014 Share Posted December 13, 2014 one example: --server addCommandHandler("handbrake", function(p) if(isPedInVehicle(p))then triggerClientEvent("onHandbrakeSoundStart",p) end end) --client addEvent("onHandbrakeSoundStart",true) addEventHandler("onHandbrakeSoundStart",root, function() local x,y,z = getElementPosition(source) playSound3D("mysong.mp3",x,y,z) end) Link to comment
DzMGZXL Posted December 14, 2014 Author Share Posted December 14, 2014 Thanks!Now everything work fine Link to comment
</Mr.Tn6eL> Posted December 14, 2014 Share Posted December 14, 2014 bindKey("handbrake", "up", function( ) if isElement(sound) then destroyElement(sound) end local x, y, z = getElementPosition(localPlayer) sound = playSound3D("mysong.mp3", x, y, z) end) 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