Welcome,
Guest
. Please
login
or
register
.
Did you miss your
activation email?
November 25, 2024, 09:15:17 PM
News:
Trouble in Terrorist Town
?
Site here
,
forum here
.
Zombie Master
|
Other
|
Trouble in Terrorist Town
| Topic:
Please help with end round music?
Pages: [
1
]
Author
Topic: Please help with end round music? (Read 4750 times)
Mr. Wepz.
Poster
Posts: 65
«
on:
February 18, 2011, 07:38:25 PM »
Hello guys, so yeah im new to this stuffs and i saw a code already on the forums i edited it a bit and i have put it in "lua/autorun/server" but it dont want to download the music file in the first place what is kinda wierd, this is my code i really dont get it its probebly full with bugs and stuff >.>
resource.AddFile("sound\innomusic.wav")
local function PlayMusic(wintype)
if wintype == WIN_TRAITOR then
BroadcastLua('surface.PlaySound("sound\innomusic.wav")')
else
BroadcastLua('surface.PlaySound("sound\innomusic.wav")')
end
end
hook.Add("TTTEndRound", "endingsongs", PlayMusic)
endingsongs.lua is the file name cuz i dint get it with "My music" thingy :|
Thanks in advance!
NaRyan
Poster
Posts: 98
Less QQ more Pew Pew
«
Reply #1 on:
February 19, 2011, 10:18:12 AM »
In my end of round music .lua file I have it as sound/ for the AddFile. (change it from sound\innomusic.wav to sound/innomusic.wav)
And for the playsound part remove the sound\ part as it is not needed.
The playsound always looks in the sound directory, so yours is looking in sound/sound/innomusic.wav
Also my hook.add is hook.Add("TTTEndRound", "MyMusic", PlayMusic)
That was taken from the example BKU posted.
«
Last Edit: February 19, 2011, 10:21:46 AM by NaRyan
»
Gimme a joint and 3 hours and I can come up with a logical system for karma :D
Mr. Wepz.
Poster
Posts: 65
«
Reply #2 on:
February 19, 2011, 11:48:46 AM »
ok so basicly its then
resource.AddFile("sound/innomusic.wav")
local function PlayMusic(wintype)
if wintype == WIN_TRAITOR then
BroadcastLua('surface.PlaySound("innomusic.wav")')
else
BroadcastLua('surface.PlaySound("innomusic.wav")')
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)
? And place it into lua/autorun/server right?
Mr. Wepz.
Poster
Posts: 65
«
Reply #3 on:
February 19, 2011, 01:39:30 PM »
Ok i tried this and it worked but i cant make the innocent song working and now suddenly the traitor song dosent work either it dont want to see the hole LUA file anymore and i even placed it into lua/autorun/server or normal autorun, it just dont work. I probebly need to put it in witout autorun.
This is my code atm.
resource.AddFile("sound/BWTraitorswin2.mp3")
resource.Addfile("sound/BWInnocentswin2.mp3")
local function PlayMusic(wintype)
if wintype == WIN_TRAITOR then
BroadcastLua('surface.PlaySound("BWTraitorswin2.mp3")')
else
BroadcastLua('surface.PlaySound("BWInnocentswin2.mp3")')
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)
Mr. Wepz.
Poster
Posts: 65
«
Reply #4 on:
February 19, 2011, 05:27:02 PM »
nvm got it working. Thanks!
puff
Poster
Posts: 4
«
Reply #5 on:
February 20, 2011, 12:47:18 AM »
Can you please tell me how fixed it?
Mr. Wepz.
Poster
Posts: 65
«
Reply #6 on:
February 20, 2011, 11:23:03 AM »
sure baslicly its simple,
resource.AddFile("sound/innocentwinz.mp3")
resource.AddFile("sound/traitorwinz.mp3")
local function PlayMusic(wintype)
if wintype != WIN_TRAITOR then
BroadcastLua('surface.PlaySound("innocentwinz.mp3")')
else
BroadcastLua('surface.PlaySound("traitorwinz.mp3")')
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)
First song what plays is when innocent wins, traitor song is second i think if u look to the code it makes sense, btw the .mp3 file or wav needs to be 1 name no caps and stuff, just one name.
You can call ur .lua file anything like i have: endingsongs.lua and it goes in lua/autorun (NOT lua/autorun/server)
NaRyan
Poster
Posts: 98
Less QQ more Pew Pew
«
Reply #7 on:
February 20, 2011, 02:07:47 PM »
And if you want to use 3 different sounds for Traitor Win, Innocent Win & Timeout Win you can do this.
Quote
esource.AddFile("sound/traitor_win.mp3")
resource.AddFile("sound/inno_win.mp3")
resource.AddFile("sound/time_win.mp3")
local function PlayMusic(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua('surface.PlaySound("inno_win.mp3")')
elseif wintype == WIN_TRAITOR then
BroadcastLua('surface.PlaySound("traitor_win.mp3")')
elseif wintype == WIN_TIMELIMIT then
BroadcastLua('surface.PlaySound("time_win.mp3")')
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)
Gimme a joint and 3 hours and I can come up with a logical system for karma :D
Mr. Wepz.
Poster
Posts: 65
«
Reply #8 on:
February 20, 2011, 06:57:13 PM »
true :D
puff
Poster
Posts: 4
«
Reply #9 on:
February 25, 2011, 09:01:08 PM »
Thank you! :D
Pages
: [
1
]
Zombie Master
|
Other
|
Trouble in Terrorist Town
| Topic:
Please help with end round music?
« previous
next »
Jump to:
Please select a destination:
-----------------------------
Other
-----------------------------
=> Trouble in Terrorist Town
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
Powered by SMF 1.1.21
|
SMF © 2015, Simple Machines
Page created in 0.009 seconds with 17 queries.
Loading...