Jump to content

Random sounds [SOLVED]


DRW

Recommended Posts

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 by Guest
Link to comment
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
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

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