DRW Posted July 12, 2015 Share Posted July 12, 2015 (edited) I've tried this, but it's not working, it says that an "(" is missing, but it's not, even if I do it as the debugscript says, there appear other errors that prevent the script from loading properly, so, no idea. Any way to make it play random sounds from 1 to 7? local numbers = {1,2,3,4,5,6,7} addEventHandler ("onClientPlayerDamage",localPlayer, function() local Zx,Zy,Zz = getElementPosition( localPlayer ) local sound = playSound3D ("sonido/hurt"[math.random(#numbers)]".WAV",Zx,Zy,Zz,false) setSoundMaxDistance (sound, 20) end) Edited July 12, 2015 by Guest Link to comment
GTX Posted July 12, 2015 Share Posted July 12, 2015 local numbers = 7 addEventHandler ("onClientPlayerDamage",localPlayer, function() local Zx,Zy,Zz = getElementPosition( localPlayer ) local sound = playSound3D ("sonido/hurt"..math.random(1, numbers)..".WAV",Zx,Zy,Zz,false) setSoundMaxDistance (sound, 20) end) Link to comment
DRW Posted July 12, 2015 Author Share Posted July 12, 2015 local numbers = 7 addEventHandler ("onClientPlayerDamage",localPlayer, function() local Zx,Zy,Zz = getElementPosition( localPlayer ) local sound = playSound3D ("sonido/hurt"..math.random(1, numbers)..".WAV",Zx,Zy,Zz,false) setSoundMaxDistance (sound, 20) end) Thanks! 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