Jump to content

little help


Blaawee

Recommended Posts

Posted

What do you mean by "random sound"? do you mean a random sound file?

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local soundsTable = { 
    [1]="sound1.mp3", 
    [2]="sound2.mp3", 
} 
  
function Music() 
   local soundPath = soundsTable[math.random(#soundsTable)] 
   sound = playSound3D("sound/"..tostring(soundPath), 568.89764, -1857.21130, 4.7015, true) 
   setSoundMaxDistance(sound, 30) 
end 
addEventHandler("onClientResourceStart", resourceRoot, Music) 

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted
local soundsTable = { 
    "sound1.mp3", 
    "sound2.mp3", 
} 
  
function Music() 
   local soundPath = soundsTable[math.random(#soundsTable)] 
   sound = playSound3D("sound/"..tostring(soundPath), 568.89764, -1857.21130, 4.7015, true) 
   setSoundMaxDistance(sound, 30) 
end 
addEventHandler("onClientResourceStart", resourceRoot, Music) 

Try that, I don't know if it'll make any difference.

San Andreas Utopia RPG (SAUR) Owner & Developer.

560x95_FFFFFF_FF9900_000000_000000.png

Education is the most powerful weapon which you can use to change the world.

Posted

Tripleposting is not allowed, nor is doubleposting.

It is pretty unlikely that it will play the second sound as you only have two sounds. It will mostly just be the other one, hardly the second one.

So, I suggest more sounds.

That script that Castillo made, should be working in my opinion.

What I understood was that the script was working but it only plays the other sound. If it's not working at all, check your meta.xml, debugscript, folders.

If I helped you, please click the like button on the right ;) Thanks!

Posted

Then do

local soundsTable = { 
    "sound1.mp3", 
    "sound2.mp3", 
    "sound3.mp3", 
    "sound4.mp3", 
    "sound5.mp3", 
} 

Posted

About tripleposting/doubleposting: Ever heard of deleting old messages, and then posting a new one.

If I helped you, please click the like button on the right ;) Thanks!

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