kewizzle Posted March 30, 2017 Share Posted March 30, 2017 Heres my code and for some reason the sound plays for everyone in the game. addEvent("playPickup",true) addEventHandler("playPickup",root, function() playSound("drops/pickuped.wav") end) function MarkerHit ( hitPlayer, matchingDimension ) playSound("drops/pickuphit.wav") end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) Link to comment
NeXuS™ Posted March 30, 2017 Share Posted March 30, 2017 addEvent("playPickup",true) addEventHandler("playPickup",root, function() playSound("drops/pickuped.wav") end) function MarkerHit ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then playSound("drops/pickuphit.wav") end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) 1 Link to comment
kewizzle Posted March 30, 2017 Author Share Posted March 30, 2017 2 hours ago, NeXuS™ said: addEvent("playPickup",true) addEventHandler("playPickup",root, function() playSound("drops/pickuped.wav") end) function MarkerHit ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then playSound("drops/pickuphit.wav") end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) it works for this part function MarkerHit ( hitPlayer, matchingDimension ) if hitPlayer == localPlayer then playSound("drops/pickuphit.wav") end end addEventHandler ( "onClientMarkerHit", getRootElement(), MarkerHit ) but this one doesnt still plays for all addEvent("playPickup",true) addEventHandler("playPickup",root, function() playSound("drops/pickuped.wav") end) i tried adding if hitPlayer == localPlayer then to that one as well but then none of the sounds work but when i pickup the item it gives an error saying, "server triggered clientside event playPickup, but event is not added clientside. Link to comment
NeXuS™ Posted March 30, 2017 Share Posted March 30, 2017 Can you paste you server sided script too? (This is an event, and it's being called by the server sided script.) 1 Link to comment
kewizzle Posted March 30, 2017 Author Share Posted March 30, 2017 1 hour ago, NeXuS™ said: Can you paste you server sided script too? (This is an event, and it's being called by the server sided script.) addEventHandler("onPickupUse",getRootElement(),function() triggerClientEvent("playPickup", source, playPickup) destroyElement(source) end) Link to comment
NeXuS™ Posted March 30, 2017 Share Posted March 30, 2017 addEventHandler("onPickupUse",getRootElement(),function(thePlayer) triggerClientEvent(thePlayer, "playPickup", source, playPickup) destroyElement(source) end) 1 Link to comment
kewizzle Posted March 30, 2017 Author Share Posted March 30, 2017 1 hour ago, NeXuS™ said: addEventHandler("onPickupUse",getRootElement(),function(thePlayer) triggerClientEvent(thePlayer, "playPickup", source, playPickup) destroyElement(source) end) im getting someone in my server right now to test this out and i will get back to you. works as expected 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