kewizzle Posted March 28, 2017 Share Posted March 28, 2017 Client.lua heres my script local speaker = createObject(2232, -657.90002441406, 944.90002441406, 12, 0, 0, 255) local url = "http://208.85.242.69:9622/listen.pls" function playMusic(button) if (button) == "left" then local sound = playSound3D(url, -657.90002441406, 944.90002441406, 12) else stopSound(sound) end end addEventHandler( "onClientClick", speaker, playMusic ) Link to comment
NeXuS™ Posted March 28, 2017 Share Posted March 28, 2017 Did you try using a local file? Maybe the link is broken. 1 Link to comment
kewizzle Posted March 28, 2017 Author Share Posted March 28, 2017 1 hour ago, NeXuS™ said: Did you try using a local file? Maybe the link is broken. i did and still wont work for some reason. i tested the file too it plays in itunes. Link to comment
NeXuS™ Posted March 28, 2017 Share Posted March 28, 2017 Try debugging? Output a text when you click on the element? Link to comment
kewizzle Posted March 28, 2017 Author Share Posted March 28, 2017 i get absolutely no errors. Link to comment
NeXuS™ Posted March 28, 2017 Share Posted March 28, 2017 Can you get a text out to the chat with outputChatBox when you click on the element? 1 Link to comment
kewizzle Posted March 28, 2017 Author Share Posted March 28, 2017 (edited) 1 hour ago, NeXuS™ said: Can you get a text out to the chat with outputChatBox when you click on the element? i cant get a message Edited March 28, 2017 by kewizzle Link to comment
NeXuS™ Posted March 28, 2017 Share Posted March 28, 2017 (edited) Try this one: function playMusic(button, state, _, _, _, _, _, clickedElement) if button == "left" and state == "down" and clickedElement == speaker then sound = playSound3D(url, -657.90002441406, 944.90002441406, 12) else stopSound(sound) end end addEventHandler("onClientClick", getRootElement(), playMusic) Edited March 28, 2017 by NeXuS™ Link to comment
kewizzle Posted March 28, 2017 Author Share Posted March 28, 2017 it only works if im holding the left click button now. 1 hour ago, NeXuS™ said: Try this one: function playMusic(button, state, _, _, _, _, _, clickedElement) if button == "left" and state == "down" and clickedElement == speaker then sound = playSound3D(url, -657.90002441406, 944.90002441406, 12) else stopSound(sound) end end addEventHandler("onClientClick", getRootElement(), playMusic) this works but then i right click the speaker the radio keeps playing function playMusic(button, state, _, _, _, _, _, clickedElement) if button == "left" and clickedElement == speaker then sound = playSound3D(url, -657.90002441406, 944.90002441406, 12) else stopSound(sound) end end addEventHandler("onClientClick", getRootElement(), playMusic) Link to comment
NeXuS™ Posted March 28, 2017 Share Posted March 28, 2017 function playMusic(button, state, _, _, _, _, _, clickedElement) if button == "left" and state == "down" and clickedElement == speaker then if isElement(sound) then stopSound(sound) else sound = playSound3D(url, -657.90002441406, 944.90002441406, 12) end end end addEventHandler("onClientClick", getRootElement(), playMusic) 1 Link to comment
kewizzle Posted March 28, 2017 Author Share Posted March 28, 2017 1 hour ago, NeXuS™ said: function playMusic(button, state, _, _, _, _, _, clickedElement) if button == "left" and state == "down" and clickedElement == speaker then if isElement(sound) then stopSound(sound) else sound = playSound3D(url, -657.90002441406, 944.90002441406, 12) end end end addEventHandler("onClientClick", getRootElement(), playMusic) works thanks. 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