Jump to content

Random sounds [SOLVED]


DRW

Recommended Posts

Posted (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 by Guest

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

Posted
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) 

Do you require a paid scripter? Contact me! (Unavailable) Currently I am experienced in Lua, PHP, HTML, CSS, SQL and JS.

Developer and owner of

https://projectbea.st - Project Beast
Posted
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!

tJ5zeFm.gif

Proud owner and developer of ZNEXT: Aftermath.

Enter a post-apocalyptic San Andreas and fight over 30 types of enemies and bosses with varying difficulties and skills, improve and customize your character by leveling up, completing challenges and a solid lootbox system with no Pay-to-Win mechanics that will break your experience.

Meet new characters, creatures and weapon metas, experience an innovative combo-based melee system, or join our solid PvP modes to show other survivors who’s boss. 

Español, Pусский, Türk, عربى, Polski, Português

IP: mtasa://104.36.110.227:22003 - Discord: https://discord.gg/CxMxjvC5pB

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