HoLsTeN Posted February 5, 2011 Posted February 5, 2011 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
proracer Posted February 5, 2011 Posted February 5, 2011 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.
HoLsTeN Posted February 5, 2011 Author Posted February 5, 2011 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
proracer Posted February 5, 2011 Posted February 5, 2011 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.
HoLsTeN Posted February 5, 2011 Author Posted February 5, 2011 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)
SDK Posted February 5, 2011 Posted February 5, 2011 addEventHandler("onClientPlayerWasted", getRootElement(), kill) 1. learn to script 2. go fight somewhere else
HoLsTeN Posted February 5, 2011 Author Posted February 5, 2011 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
SDK Posted February 5, 2011 Posted February 5, 2011 then add "if killer == getLocalPlayer()" Maybe you should try to learn it anyway, this is very basic
Aibo Posted February 5, 2011 Posted February 5, 2011 offtopic deleted, please use appropriate language section for such conversations.
HoLsTeN Posted February 6, 2011 Author Posted February 6, 2011 function kill (killer) if source ~= getLocalPlayer()" local sound = playSound("wasted.mp3") setSoundVolume(sound, 0.5) end addEventHandler("onClientPlayerWasted", getRootElement(), kill) not work
12p Posted February 6, 2011 Posted February 6, 2011 function kill ( attacker ) if attacker ~= getLocalPlayer ( ) then local sound = playSound("wasted.mp3", false) setSoundVolume(sound, 0.5) end end addEventHandler ( "onClientPlayerWasted", getRootElement ( ), kill)
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