Jump to content

[HELP] How to make this script?


Tokio

Recommended Posts

Posted

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? :S 

Posted
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? :S 

Can you post your code ?

Posted (edited)
addEventHandler("onClientPlayerDamage", root, function(attacker, weapon, bodypart) 
    if bodypart ==9 then
      playSound
      end 
    end) 

 

Edited by Dimos7
Posted
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?

Posted
Just now, 50cent said:

This play sound for killed player or localplayer?

 

the code is not complete, no sound will be produced

Posted
Just now, <~KaMiKaZe~> said:

 

the code is not complete, no sound will be produced

I know. But for killed player, or localplayer?

Posted
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

Posted

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.

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