Jump to content

if i kill any one play sound


HoLsTeN

Recommended Posts

Posted

hi all

this code for play sound if i kill any one

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

help me pleas

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

Posted
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

Posted

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.

Posted
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)

Posted
addEventHandler("onClientPlayerWasted", getRootElement(), kill) 

1. learn to script

2. go fight somewhere else

1 - read the topic i say if i kill not if i die

2 - i am not fight

Posted
function kill (killer) 
     if source ~= getLocalPlayer()" 
local sound = playSound("wasted.mp3") 
    setSoundVolume(sound, 0.5) 
end 
addEventHandler("onClientPlayerWasted", getRootElement(), kill) 
 

not work

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

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