Jump to content

[Help] Killer Sound


Recommended Posts

This should work: 

function wasted (killer, weapon, bodypart)
	if ( killer == localPlayer ) then
		local sound = playSound("sound/sound.wav")
		setSoundVolume( sound, 0. )
	end
	
end
addEventHandler("onClientPlayerWasted", root, wasted)

 

  • Like 1
Link to comment
7 hours ago, Rose said:

This should work: 


function wasted (killer, weapon, bodypart)
	if ( killer == localPlayer ) then
		local sound = playSound("sound/sound.wav")
		setSoundVolume( sound, 0. )
	end
	
end
addEventHandler("onClientPlayerWasted", root, wasted)

 

 

Did not work...

Link to comment
26 minutes ago, Phelipecg said:

 

Did not work...

Everyone hear the sound?

Try to change root for getLocalPlayer() in onClientPlayerWasted event.

Or try this code: 

 

function wasted (killer, weapon, bodypart)
	triggerServerEvent("killerSound", getLocalPlayer(), killer)
end
addEventHandler("onClientPlayerWasted", root, wasted)

addEvent("playTheSound", true)
addEventHandler("playTheSound", root, 
  function( )
     local sound = playSound("sound/sound.wav")
	 setSoundVolume( sound, 1 )
  end 
)
-- SERVER 

addEvent("killerSound", true)
addEventHandler("killerSound", root, 
  function( killer ) 
     triggerClientEvent( killer, "playTheSound", killer )
  end 
)

 

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