Making a weapon that has more than one primary fire sound

The Subject pretty much sums up what my problem is, how can i make a SWEP choose randomly from a list of sounds? (like a group of sounds in a folder) So that there is more than one primary fire sound when i, um, primary fire.

Make a table of the sounds you want. Then use table.Random to get a random sound.

Thank you for the advice, im going to give it a try now

[editline]09:50PM[/editline]

Dident quite work out, do you think you can show me an example of the table random being used with SWEP’s primary fire sound?

This is untested, but I’m sure it would work.
[lua]local sounds = {
Sound(“lala.wav”),
Sound(“superlazer.wav”),
Sound(“wut.wav”)
}

function SWEP:PrimaryAttack()

self.Owner:EmitSound(table.Random(sounds, 100, 100))

end[/lua]

[lua]local sounds = {
Sound(“lala.wav”),
Sound(“superlazer.wav”),
Sound(“wut.wav”)
}

function SWEP:PrimaryAttack()

self.Owner:EmitSound(table.Random(sounds), 100, 100)

end[/lua]

I think you mean this. :smile:

Crazy?
Could you please add me on steam?
Need help :stuck_out_tongue_winking_eye:

username; MariusAasgaard

Thank you Crazy Quebec, im going to try it out now

wee that could help me too with some stuff i make thx a lot