Cookie Posted August 7, 2011 Share Posted August 7, 2011 (edited) EDIT: Got the sound working. But it's low range. Read the bottom of the post pl0x.Hi.For my new map I need a script that plays local sounds and then, when you're in range of the coordinates you can hear the mp3 playing. Though I'm an absolute noob on scripting shizzle, I needz sum helpzSDK is already trying to help me, so thnx to him I found this:http://wiki.multitheftauto.com/wiki/PlaySound3DSo I created localsound1.lua which has this line in it: playSound3D("sounds/crysis.mp3", 4243, -932, 460, true)My mp3 is inside a folder and the mp3 is called Crysis, so that should work right?Then I edited the meta so it looks like this<meta> <info gamemodes="race" type="map" name="DDestruction Race by Cookie" author="Cookie" version="1.0" description="Ruuuuuuun fucking ruuuuuuuuun" /> <map src="aa9.map" dimension="0" /> <settings> <setting name="#skins" value='[ "cj" ]' /> <setting name="#maxplayers" value="[ 32 ]" /> <setting name="#gamespeed" value="[ 1 ]" /> <setting name="#ghostmode" value='[ "false" ]' /> <setting name="#time" value="1:0" /> <setting name="#vehicleweapons" value='[ "false" ]' /> <setting name="#minplayers" value="[ 0 ]" /> <setting name="#weather" value="[ 7 ]" /> <setting name="#gravity" value="[ 0.008000 ]" /> <setting name="#waveheight" value="[ 0 ]" /> <setting name="#respawntime" value="[ 5 ]" /> <setting name="#locked_time" value="[ false ]" /> <setting name="#duration" value="[ 1800 ]" /> <setting name="#respawn" value='[ "timelimit" ]' /> </settings><script src="localsound1.lua" type="client" /></meta>Though when I test the map I can't hear shit. In testing mode nor construct mode. What am I doing wrong?EDIT:It's working. I forgot to put<file src="files/music.mp3" />Into the meta.It's range is very low though. How do I increase the range? Edited August 7, 2011 by Cookie Quote Link to comment
Ywa Posted August 7, 2011 Share Posted August 7, 2011 You could try this:http://wiki.multitheftauto.com/wiki/SetSoundMaxDistance Quote Link to comment
Cookie Posted August 7, 2011 Author Share Posted August 7, 2011 (edited) Yes i'm figuring that out atm, but I have no clue how it works.So I have this in my localsound1.lua playSound3D("sounds/crysis.mp3", 4243, -932, 460, true)If I want a wider range, what do I need to put beneath it?something like:setSoundMaxDistance ( "localsound1.lua", 50 )Or something? Edited August 7, 2011 by Cookie Quote Link to comment
Ywa Posted August 7, 2011 Share Posted August 7, 2011 This should work:local sound = playSound3D("sounds/crysis.mp3", 4243, -932, 460, true)setSoundMaxDistance ( sound, 50 )And of course you still need to play around with the actual distance value. Quote Link to comment
Cookie Posted August 7, 2011 Author Share Posted August 7, 2011 (edited) Thnx it works now!Now I need another script that triggers a moving object. Is that easy to do? I already made the moving object. Now when you drive on it, (for example) it leaves in 10 seconds.This is the moving object:function omg_lift3() lift3 = createObject(10789, 4186.8369140625, -938.10723876953, 616.61059570313, 0, 0, 69.818115234375) omgMovelift3(1)endfunction omgMovelift3(point) if point == 1 then moveObject(lift3, 30000, 4186.8369140625, -938.10723876953, 457.21499633789, 0, 0, 0) setTimer(omgMovelift3, 30000+6000, 1, 2) elseif point == 2 then moveObject(lift3, 30000, 4186.8369140625, -938.10723876953, 616.61059570313, 0, 0, 0) setTimer(omgMovelift3, 30000+6000, 1, 1) endendaddEventHandler("onResourceStart", getResourceRootElement(getThisResource()), omg_lift3) Edited August 7, 2011 by Cookie Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.