Tokio Posted April 16, 2018 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?
KaMi Posted April 16, 2018 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 ?
Dimos7 Posted April 16, 2018 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
Tokio Posted April 16, 2018 Author 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?
KaMi Posted April 16, 2018 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
Tokio Posted April 16, 2018 Author 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?
KaMi Posted April 16, 2018 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
Manticore Posted April 16, 2018 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.
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