Hello guys. First of all, I don't know anything about scripting, I just copied the codes from wiki and other scripts. I was trying to play an mp3 file in Jizzy's Club, and I did it somehow, music is playing when I enter the club but when I reconnect to the server the mp3 file plays from beginning. I haven't tried with someone else but I guess it isn't synchronized with other players. It is a 20 minutes long mix of songs so I want to be sure that everyone hears the same music at the same time. I read some topics about playsound3d and synchronization however I couldn't figured it out how to do that. Can you help me guys?
This is the code. I guess I need a server side script.
addEventHandler('onClientResourceStart', resourceRoot,
function()
local sound = playSound3D("Dj_Ivan.mp3", -2677, 1411, 908, true)
setSoundMaxDistance(sound, 100)
setSoundVolume(sound, 4)
end
)
function disableClubMusic()
if getElementInterior(localPlayer) == 3 and getDistanceBetweenPoints3D(-2677, 1411, 908, getElementPosition(localPlayer)) < 50 and getInteriorSoundsEnabled() then
setInteriorSoundsEnabled(false)
elseif not getInteriorSoundsEnabled() then
setInteriorSoundsEnabled(true)
end
end
addEventHandler("onClientPreRender", root, disableClubMusic)