Tokio Posted April 16, 2018 Share Posted April 16, 2018 I want create a script, which play a sound, when a player shot another player head. But the sound play for killed player and localplayer too. How to make this? Link to comment
KaMi Posted April 16, 2018 Share Posted April 16, 2018 6 minutes ago, 50cent said: I want create a script, which play a sound, when a player shot another player head. But the sound play for killed player and localplayer too. How to make this? Can you post your code ? Link to comment
Dimos7 Posted April 16, 2018 Share Posted April 16, 2018 (edited) addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart) if bodypart ==9 then playSound end end) Edited April 16, 2018 by Dimos7 Link to comment
Tokio Posted April 16, 2018 Author Share Posted April 16, 2018 1 minute ago, Dimos7 said: addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart) if bodypart ==5 then playSound end end) This play sound for killed player or localplayer? Link to comment
KaMi Posted April 16, 2018 Share Posted April 16, 2018 Just now, 50cent said: This play sound for killed player or localplayer? the code is not complete, no sound will be produced Link to comment
Tokio Posted April 16, 2018 Author Share Posted April 16, 2018 Just now, <~KaMiKaZe~> said: the code is not complete, no sound will be produced I know. But for killed player, or localplayer? Link to comment
KaMi Posted April 16, 2018 Share Posted April 16, 2018 addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart) if bodypart == 9 then local x,y,z = getElementPosition(localPlayer) local sonido = playSound3D("files/yoursound.mp3", x, y, z) attachElements (sonido,localPlayer, 0, 0, 0 ) setSoundVolume( sonido, 1 ) setSoundMinDistance(sonido, 1) setSoundMaxDistance(sonido, 50) end end) That will make the sound heard for the local player Link to comment
Manticore Posted April 16, 2018 Share Posted April 16, 2018 Or this function wasted (killer, weapon, bodypart) local sound = playSound("files/yourmusic.mp3") setSoundVolume(sound, 0.5) end addEventHandler("onClientPlayerWasted", localPlayer, wasted) Make sure to add that script in Client side. 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