Welcome, Guest. Please login or register.
Did you miss your activation email?
November 22, 2024, 01:06:39 AM
Home Help Login Register
News: Trouble in Terrorist Town? Site here, forum here.

Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Music setting
Pages: [1]
Author Topic: Music setting  (Read 6629 times)
Shifty Pete
Poster

Posts: 74


Shifty_Pete.exe


« on: January 05, 2012, 02:20:07 PM »

Okay so I've coded in some server intro music, but want a way to be able to turn it off.

First of all, I want to make a console command (ttt_intro_music). I assume I use
CreateClientConVar("ttt_intro_music", "1", true, true)


But how do I make it saves the setting for the client & doesn't play the intro music if set to 0?

Also, how do I add a checkbox for it to the F1 settings?

http://www.steamcommunity.com/id/shifty_pete
Tommynator
Poster

Posts: 173

Tommynator is a traitor!


« Reply #1 on: January 05, 2012, 09:33:05 PM »

How is this stickied omg.

It should already save the settings for the clients as the third argument is true, see http://wiki.garrysmod.com/?title=G.CreateClientConVar

Edit cl_help.lua for the F1 settings.
Add a CheckBox to dgui object, like that :


dgui:CheckBox("Your Text", "ttt_intro_music")


Edit : No really, are you sticking Shifty Pete's threads when he needs help?  :D
This is unfair

Edit 2 : Yeah nvm
« Last Edit: January 05, 2012, 09:57:32 PM by Tommynator »
Shifty Pete
Poster

Posts: 74


Shifty_Pete.exe


« Reply #2 on: January 05, 2012, 11:38:39 PM »

Here's what I've got:

local intro_music_enabled = CreateClientConVar("ttt_intro_music", "1", true, true)	

local function PlayMusic()

ply:SendLua("surface.PlaySound(\"intro/intro.wav\")")
end

hook.Add( "PlayerInitialSpawn", "PlayIntroMusic", PlayMusic )


How do I make it so it only plays the music when set to 1? I've tried doing it myself but I can't seem to get it right.
« Last Edit: January 06, 2012, 02:12:43 AM by Shifty Pete »

http://www.steamcommunity.com/id/shifty_pete
sniperduck
Poster

Posts: 178


|:NxS:| Staff! :D


« Reply #3 on: January 06, 2012, 02:00:08 AM »

How is this stickied omg.


Its not, the one above it is.

Overtime these forums have made me an asshole. ;D (TTT subforum)
|:NxS:| Custom TTT Server: source.nxs-gaming.com:27016
|:NxS:| Vanilla TTT Server: source.nxs-gaming.com:27016
|:NxS:| Fretta: <COMING SOON>
Shifty Pete
Poster

Posts: 74


Shifty_Pete.exe


« Reply #4 on: January 06, 2012, 03:53:19 AM »

Don't worry, I figured it out.

http://www.steamcommunity.com/id/shifty_pete
Pages: [1]
Zombie Master  |  Other  |  Trouble in Terrorist Town  |  Topic: Music setting « 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.011 seconds with 18 queries.