HoLsTeN Posted February 5, 2011 Share 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 Link to comment
proracer Posted February 5, 2011 Share 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. Link to comment
HoLsTeN Posted February 5, 2011 Author Share 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 Link to comment
proracer Posted February 5, 2011 Share 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. Link to comment
HoLsTeN Posted February 5, 2011 Author Share 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) Link to comment
SDK Posted February 5, 2011 Share Posted February 5, 2011 addEventHandler("onClientPlayerWasted", getRootElement(), kill) 1. learn to script 2. go fight somewhere else Link to comment
HoLsTeN Posted February 5, 2011 Author Share 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 Link to comment
SDK Posted February 5, 2011 Share Posted February 5, 2011 then add "if killer == getLocalPlayer()" Maybe you should try to learn it anyway, this is very basic Link to comment
Aibo Posted February 5, 2011 Share Posted February 5, 2011 offtopic deleted, please use appropriate language section for such conversations. Link to comment
HoLsTeN Posted February 6, 2011 Author Share 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 Link to comment
12p Posted February 6, 2011 Share 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) Link to comment
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