Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 02:16:10 PM
Home Help Login Register
News: Zombie Master 2 discussion

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Trouble in Terrorist Town Help (Music)
Pages: [1]
Author Topic: Trouble in Terrorist Town Help (Music)  (Read 5515 times)
Apozen
Poster

Posts: 18


« on: June 29, 2011, 04:14:40 PM »

Hello everyone,
I recently made a TTT server a while back, and I'd like to add music at the end of rounds. I read through some posts on this website, and managed to get one working. Here it is:

resource.AddFile("sound/ttt/traitor_win.mp3")
resource.AddFile("sound/ttt/inno_win.mp3")
resource.AddFile("sound/ttt/time_win.mp3")

local function PlayMusic(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua('surface.PlaySound("ttt/inno_win.mp3")')

elseif wintype == WIN_TRAITOR then
BroadcastLua('surface.PlaySound("ttt/traitor_win.mp3") ')

elseif wintype == WIN_TIMELIMIT then
BroadcastLua('surface.PlaySound("ttt/time_win.mp3")')
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)


That one works wonderfully, but I get tired of hearing the same "Traitors Win" and "Innocents Win" all the time. Does anyone know how to make this so it plays a sound from random, no matter who wins? Thanks a bunch C:
Smexy
Poster

Posts: 27

PM Me for Girl Support :P


« Reply #1 on: June 29, 2011, 04:17:25 PM »

There defenitly is a 'random' selection for lua, but I don't know it off by heart. Sorry hun

xxx

Regards
Smexy Beast

Yes, Im a girl.
Got a problem with that?
                                          There are two medicines 1. Talk to my fist in your mouth 2. Go see a god damn anal doctor.

Amen
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #2 on: June 29, 2011, 07:33:21 PM »

Math.random ?
Apozen
Poster

Posts: 18


« Reply #3 on: June 29, 2011, 10:10:44 PM »


resource.AddFile("sound/ttt/blow.mp3")

local music = {
Sound("ttt/blow.mp3"),

};

local function PlayMusic(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua([[surface.PlaySound(]]..music[math.random(1, table.GetLastValue)]

elseif wintype == WIN_TRAITOR then
BroadcastLua([[surface.PlaySound(]]..music[math.random(1, table.GetLastValue)]

elseif wintype == WIN_TIMELIMIT then
BroadcastLua([[surface.PlaySound(]]..music[math.random(1, table.GetLastValue)]
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)


I tried this, and It didn't work. :(
Apozen
Poster

Posts: 18


« Reply #4 on: July 01, 2011, 12:48:47 AM »

Resolved on another thread, didn't get hardly any help here....
Handy_man
Poster

Posts: 308


SNG community admin


« Reply #5 on: July 01, 2011, 01:08:57 AM »

Resolved on another thread, didn't get hardly any help here....


You're welcome.

[b]
Sky-netgaming.com
GrayScare0
Poster

Posts: 404


« Reply #6 on: July 02, 2011, 05:52:06 PM »

Well, that is why there is a search function.  Not trying to be rude.
Scrap.est
Poster

Posts: 6782


Gigglfarting


« Reply #7 on: July 02, 2011, 06:09:53 PM »

Resolved on another thread, didn't get hardly any help here....

That hurt man...that really hurt. Do you enjoy talking down to others? :(

The faster they fester the quicker they muster.
dude I am in the gifted program. I am probably more intelligent than you hell I am more intelligent than you. Come one you and 90% of the ZM forum are trolls
Apozen
Poster

Posts: 18


« Reply #8 on: July 02, 2011, 08:34:53 PM »

That hurt man...that really hurt. Do you enjoy talking down to others? :(

Haha, no I do not. I didn't mean AT ALL to sound rude.
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Trouble in Terrorist Town Help (Music) « previous next »
Jump to:  


Login with username, password and session length

Powered by SMF 1.1.21 | SMF © 2015, Simple Machines
Page created in 0.009 seconds with 18 queries.