Jump to content

playSound plays the sounds for everyone


kewizzle

Recommended Posts

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
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 )

 

  • Like 1
Link to comment
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
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
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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...