BorderLine Posted November 10, 2011 Share Posted November 10, 2011 Hi community i have a question well im trying to make a script, and is like this serverside marker1 = createMarker (815.5,-1107.5,24.7,"cylinder",1.1,255,255,225,255) function m1( ) playSound ( "soundshop/hi.mp3", false ) end addEventHandler( "onMarkerHit", marker1, m1) when im hit the marker, play the sound. but dont work Link to comment
Aibo Posted November 10, 2011 Share Posted November 10, 2011 click playSound in your script and read wiki page about playSound function. Link to comment
12p Posted November 10, 2011 Share Posted November 10, 2011 Also the event is onClientMarkerHit, because it's client code. PlaySound doesn't work on server side. Link to comment
BorderLine Posted November 10, 2011 Author Share Posted November 10, 2011 thx a loot now work with this code clientside- marker2 = createMarker (2797.5,-1465.6,19.218,"cylinder",1.1,255,255,225,255) function m2 (hitplayer) local sound = playSound("soundshop/hi.mp3") end addEventHandler("onClientMarkerHit", marker2, m2) Link to comment
BorderLine Posted November 10, 2011 Author Share Posted November 10, 2011 but how i can make only sound for player.. when i hit marker.. all players in server can hear sound Link to comment
Aibo Posted November 10, 2011 Share Posted November 10, 2011 you need to check if the element that hit the marker is the local player: marker2 = createMarker(2797.5, -1465.6, 19.218, "cylinder", 1.1, 255, 255, 225, 255) function m2(hitplayer) if hitplayer == localPlayer then playSound("soundshop/hi.mp3") end end addEventHandler("onClientMarkerHit", marker2, m2) Link to comment
BorderLine Posted November 10, 2011 Author Share Posted November 10, 2011 thx a lot again.. work perfect 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