Jump to content

if i kill any one play sound


HoLsTeN

Recommended Posts

function kill () 
local sound = playSound("wasted.mp3") 
    setSoundVolume(sound, 0.5) 
end 
addEventHandler("onClientPlayerWasted", getLocalPlayer(), kill) 

You did wrong because playSound is only called from clientside and you used onPlayerWasted which is Serverside.

thank you but

i mean if i kill any one not if die

becose that i use onPlayerWasted

Link to comment
If you want to play sound for the killer than you can try this.
function kill (killer) 
local sound = playSound("wasted.mp3") 
    setSoundVolume(sound, 0.5) 
end 
addEventHandler("onClientPlayerWasted", killer, kill) 

Tell me if it gives any errors.

not work this is the eror

Warming :Bad argument @ 'addEventHandler' (string-defined function)

Link to comment
function kill ( attacker ) 
      if attacker ~= getLocalPlayer ( ) then 
         local sound = playSound("wasted.mp3", false) 
         setSoundVolume(sound, 0.5) 
      end 
end 
addEventHandler ( "onClientPlayerWasted", getRootElement ( ), kill) 

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