Kenix Posted November 22, 2010 Share Posted November 22, 2010 I have made a script that when at the player of 90 hp plays a sound of knock of heart. But the script doesn't work help please! local HP = getLocalPlayer() heartsoundPlayer = function() local localHealth = getElementHealth(HP) if localHealth < 90 then playSound("heart.mp3", false) setSoundVolume(sound, 2.5) -- set the sound volume to 50% end end addEventHandler("onClientPlayerDamage", HP, heartsoundPlayer) Link to comment
dzek (varez) Posted November 22, 2010 Share Posted November 22, 2010 wtf is line 3? i havent heard about defining functions like that.. replace with function heartsoundPlayer() also line 7 - setting volume over 1 has NO EFFECT (and comment on that line saying something about 50% is false) Link to comment
Kenix Posted November 22, 2010 Author Share Posted November 22, 2010 And all works excuse Link to comment
Kenix Posted November 22, 2010 Author Share Posted November 22, 2010 Only there is a problem this sound always plays as to make that it didn't play after death? Link to comment
Kenix Posted November 22, 2010 Author Share Posted November 22, 2010 There is a problem when the player dies a sound all the same plays = ( Link to comment
DiSaMe Posted November 22, 2010 Share Posted November 22, 2010 wtf is line 3?i havent heard about defining functions like that.. replace with function heartsoundPlayer() It's fine: http://lua-users.org/wiki/FunctionsTutorial 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