dorken Posted December 13, 2023 Share Posted December 13, 2023 hi mta community just i have a mta realsounds effects like play in city or something anyway i want if you go to this pos the sound stop and play another sound this script i do and i need the stop (city.mp3) and plays (tenger.mp3) sry is bad english just if you dont (understand) im sorry local sounds = {} addEventHandler("onClientResourceStart", getRootElement(), function() local newValue = getElementData(localPlayer, "loggedIn") if newValue == true then sounds[1] = playSound3D("files/tenger.mp3", 1382.8380126953, 479.56735229492, 20.468042373657, true) -- tenger setSoundMaxDistance(sounds[1], 50) sounds[2] = playSound3D("files/city.mp3", 1362.4620361328, -22.705436706543, 95.041290283203, true) setSoundMaxDistance(sounds[2], 5000) end end ) local sound = {} function startSound() for i, v in ipairs(sounds) do sound[i] = playSound3D(sounds[i][4], sounds[i][1], sounds[i][2], sounds[i][3], true) setSoundMaxDistance(sound[i], 2000) setSoundVolume(sound[i], 1) end end addEventHandler("onClientResourceStart", getResourceRootElement(), startSound) Note: just in the future will add more sounds Link to comment
dorken Posted December 13, 2023 Author Share Posted December 13, 2023 (edited) 5 hours ago, dorken said: hi mta community just i have a mta realsounds effects like play in city or something anyway i want if you go to this pos the sound stop and play another sound this script i do and i need if you go to (tenger.mp3) pos the (city.mp3) stop and plays (tenger.mp3) sry is bad english just if you dont (understand) im sorry local sounds = {} addEventHandler("onClientResourceStart", getRootElement(), function() local newValue = getElementData(localPlayer, "loggedIn") if newValue == true then sounds[1] = playSound3D("files/tenger.mp3", 1382.8380126953, 479.56735229492, 20.468042373657, true) -- tenger setSoundMaxDistance(sounds[1], 50) sounds[2] = playSound3D("files/city.mp3", 1362.4620361328, -22.705436706543, 95.041290283203, true) setSoundMaxDistance(sounds[2], 5000) end end ) local sound = {} function startSound() for i, v in ipairs(sounds) do sound[i] = playSound3D(sounds[i][4], sounds[i][1], sounds[i][2], sounds[i][3], true) setSoundMaxDistance(sound[i], 2000) setSoundVolume(sound[i], 1) end end addEventHandler("onClientResourceStart", getResourceRootElement(), startSound) Note: just in the future will add more sounds Edited December 13, 2023 by dorken Link to comment
mazarati21 Posted December 16, 2023 Share Posted December 16, 2023 local sounds = {} addEventHandler("onClientResourceStart", getRootElement(), function() local isLoggedIn = getElementData(localPlayer, "loggedIn") if isLoggedIn then sounds[1] = { file = "files/tenger.mp3", x = 1382.8380126953, y = 479.56735229492, z = 20.468042373657, maxDistance = 50 } sounds[2] = { file = "files/city.mp3", x = 1362.4620361328, y = -22.705436706543, z = 95.041290283203, maxDistance = 5000 } for _, soundData in ipairs(sounds) do local soundElement = playSound3D(soundData.file, soundData.x, soundData.y, soundData.z, true) setSoundMaxDistance(soundElement, soundData.maxDistance) setSoundVolume(soundElement, 1) end end end ) Try this Link to comment
dorken Posted December 16, 2023 Author Share Posted December 16, 2023 its the same its dont stop just i want if you go to tenger pos the city sound stop the code send me i 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