Volltron Posted March 6, 2017 Share Posted March 6, 2017 (edited) Hello there again, I have a problem with my script. I want to make so when someone plays music in their car it will make others near hear it too but it doesn't start and I don't know what the problem is Client : local music = "blah.wav" function playTheSound(x, y, z, vehicle) sound = playSound3D(music, x, y, z) attachElements(sound, vehicle) setSoundMaxDistance(sound,50) setSoundVolume(sound,1) end addEvent("playTheSound", true) addEventHandler("playTheSound", root, playTheSound) function stopTheSound(x, y, z) stopSound(sound) end addEvent("stopTheSound", true) addEventHandler("stopTheSound", root, stopTheSound) Server : function playMusic(thePlayer) if (isPedInVehicle(thePlayer)) then local x, y, z = getElementPosition(thePlayer) local vehicle = getPedOccupiedVehicle(thePlayer) triggerClientEvent(root, "playTheSound", root, x, y, z, vehicle) else outputChatBox("You must be in a vehicle!", thePlayer, 0, 0, 255) end end addCommandHandler("start", playMusic) function stopMusic(thePlayer) triggerClientEvent("stopTheSound", root) end addCommandHandler("stop", stopMusic) Edited March 6, 2017 by Volltron Link to comment
#BrosS Posted March 6, 2017 Share Posted March 6, 2017 i just tried it thing is change the command you can't use start or stop Link to comment
Volltron Posted March 6, 2017 Author Share Posted March 6, 2017 Thanks for that haha, you saved my ass 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