Welcome, Guest. Please login or register.
Did you miss your activation email?
November 10, 2024, 09:43:16 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

  Show Posts
Pages: [1]
1  Other / Trouble in Terrorist Town / Re: Playing a sound on round end/start on: September 09, 2010, 03:24:50 AM
Ugh... I know I was missing something easy. I should have reviewed the surface.PlaySound on the wiki...

Anyways, thanks for the help. I noticed looking through the gamemode files cl_init.lua I found there is a TTTBeginRound... so I assume I could create another hook to play so sort of beginning of round sound?

I also noticed the:
 GetConVar("ttt_cl_soundcues"):GetBool() then 


code which is for the new variable to enable sounds... is it possible for me to overwrite those variables and functions in my ttt_hooks.lua with my own data.

I'd like to have the sound option default to "1" instead of "0" so the sound is on by default, but can be turned off if the user goes into the menu. Then I want to overwrite the function with my own data for the end of round sound. So I was hoping that could be done in my own file without modifying the gamemode file which gets updated all the time when a new ttt update comes out.

Again thanks for all the help
2  Other / Trouble in Terrorist Town / Re: Playing a sound on round end/start on: September 08, 2010, 03:03:28 AM
Someone correct me if I'm wrong... which I assume I am seeing as how its not working; server is updated to v13 and I have the following code in a ttt_hooks.lua file in lua/autorun


resource.AddFile("sound/ttt/iswin.mp3")
resource.AddFile("sound/ttt/tswin.mp3")

// End of Round Sound NOT MUSIC
local function PlaySound(wintype)
if wintype == WIN_INNOCENT then
BroadcastLua('surface.PlaySound("sound/ttt/iswin.mp3")')
else
BroadcastLua('surface.PlaySound("sound/ttt/tswin.mp3")')
end
end
hook.Add("TTTEndRound", "PlaySound", PlaySound)


obviously this file is hosted on the server, and the sound files are also hosted on the server. The sound however does not play at the end of the round.

Any help is appreciated.
3  Other / Trouble in Terrorist Town / Re: Playing a sound on round end/start on: September 07, 2010, 03:28:30 AM
I would recommend using hooks rather than modifying TTT files directly.

Put this in a Lua script that runs on the server (not clients):
resource.AddFile("/path/to/music/traitor_win.mp3")
resource.AddFile("/path/to/music/inno_win.mp3")

local function PlayMusic(wintype)
  if wintype == WIN_INNOCENT then
      BroadcastLua('surface.PlaySound("/path/to/music/inno_win.mp3")')
  else
      BroadcastLua('surface.PlaySound("/path/to/music/traitor_win.mp3")')
  end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)


This won't work yet in v12, because the EndRound hook didn't get the parameter specifying who won. I've added that in the SVN build.


When can we expect an update on the the EndRound parameter being available so we can use it in hooks?
Pages: [1]


Login with username, password and session length

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