Welcome, Guest. Please login or register.
Did you miss your activation email?
December 04, 2024, 08:23:17 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Two lua files. Neither work.
Pages: [1]
Author Topic: Two lua files. Neither work.  (Read 6004 times)
Charrax
Poster

Posts: 6


« on: February 11, 2012, 02:00:09 AM »

So I have two files. colours.lua (the u is on purpose) and roundsong.lua

Both use the hooks but neither work.

Colours is in autorun. Roundsong is in autorun/server.

RoundSong
resource.AddFile("sound/ttt/tators.wav")
resource.AddFile("sound/ttt/roundstart.mp3")

local function PlayMusic(wintype)
  if wintype == WIN_INNOCENT then
      BroadcastLua('surface.PlaySound("ttt/thump01e.mp3")')
  else
      BroadcastLua('surface.PlaySound("ttt/tators.wav")')
  end
end
hook.Add("TTTEndRound", "PlayMusic", PlayMusic)

local function PlayStartMusic()
if GetRoundState() == ROUND_BEGIN then
BroadcastLua('surface.PlaySound("ttt/roundstart.mp3")')
end
hook.Add("TTTBeginRound", "PlayStartMusic", PlayStartMusic)


Colours
if SERVER then
  AddCSLuaFile("colours.lua")
else

  function OwnerColors(ply)
if ply:SteamID() == "STEAM_0:0:9310913" then -- Charrax
return Color( 5, 181, 225 )
end
end

hook.Add( "TTTScoreboardColorForPlayer ", "OwnerColors", ColorName )

end
Mr. Gash
Poster

Posts: 382


www.nonerdsjustgeeks.com


« Reply #1 on: February 11, 2012, 02:31:28 AM »


if SERVER then
  AddCSLuaFile("colours.lua")
else
  function OwnerColors(ply)
if ply:SteamID() == "STEAM_0:0:9310913" then -- Charrax
return Color( 5, 181, 225 )
end
end
hook.Add( "TTTScoreboardColorForPlayer", "OwnerColors", OwnerColors )
end


As for the music, are you getting any errors? (And you don't need to check the round state in the TTTBeginHook, it won't be getting called at any other time.) Try putting the sound files in somewhere other than /ttt/.
Charrax
Poster

Posts: 6


« Reply #2 on: February 11, 2012, 02:48:06 AM »

Nvm working :D

I removed the "if GetRoundState() == ROUND_BEGIN then"
« Last Edit: February 11, 2012, 03:13:37 AM by Charrax »
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Two lua files. Neither work. « 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.012 seconds with 17 queries.