[QUOTE=Apozen;30887881]-snip-[/QUOTE]
Use my code, I suggest not taking advice from samdama or lamalord or remscar ect and especially not jrj996..
[lua]local music = {
"ttt/pwnedftw.wav",
"ttt/pwnsong.mp3",
"ttt/horse.mp3",
"ttt/snakeeater.mp3",
"ttt/thisfire.mp3"
}
local innowintable = {
"ttt/snakeeater.mp3",
"ttt/horse.mp3"
}
local traitorwintable = {
"ttt/pwnedftw.wav",
"ttt/pwnsong.mp3",
"ttt/thisfire.mp3"
}
local function PlayMusic(ttype)
if ttype == 1 then
BroadcastLua([[LocalPlayer():EmitSound(']]..innowintable[math.random(1,#innowintable)]..[[')]])
elseif ttype == 2 then
BroadcastLua([[LocalPlayer():EmitSound(']]..traitorwintable[math.random(1,#traitorwintable)]..[[')]])
elseif ttype == 3 then
BroadcastLua([[LocalPlayer():EmitSound(']]..music[math.random(1,#music)]..[[')]])
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)[/lua]
[QUOTE=RetTurtl3;30888494]Use my code, I suggest not taking advice from samdama or lamalord or remscar ect..
[lua]local music = {
"ttt/pwnedftw.wav",
"ttt/pwnsong.mp3",
"ttt/horse.mp3",
"ttt/snakeeater.mp3",
"ttt/thisfire.mp3"
}
local innowintable = {
"ttt/snakeeater.mp3",
"ttt/horse.mp3"
}
local traitorwintable = {
"ttt/pwnedftw.wav",
"ttt/pwnsong.mp3",
"ttt/thisfire.mp3"
}
local function PlayMusic(ttype)
if ttype == 1 then
BroadcastLua([[LocalPlayer():EmitSound(']]..innowintable[math.random(1,#innowintable)]..[[')]])
elseif ttype == 2 then
BroadcastLua([[LocalPlayer():EmitSound(']]..traitorwintable[math.random(1,#traitorwintable)]..[[')]])
elseif ttype == 3 then
BroadcastLua([[LocalPlayer():EmitSound(']]..music[math.random(1,#music)]..[[')]])
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)[/lua][/QUOTE]
Whoa, whoa, now you can't talk shit about everyone else (because I don't know them) but Remscar can actually code so before you try talking someone down take a look at your code, bro.
[QUOTE=RetTurtl3;30888494]Use my code, I suggest not taking advice from samdama or lamalord or remscar ect..
[lua]local music = {
"ttt/pwnedftw.wav",
"ttt/pwnsong.mp3",
"ttt/horse.mp3",
"ttt/snakeeater.mp3",
"ttt/thisfire.mp3"
}
local innowintable = {
"ttt/snakeeater.mp3",
"ttt/horse.mp3"
}
local traitorwintable = {
"ttt/pwnedftw.wav",
"ttt/pwnsong.mp3",
"ttt/thisfire.mp3"
}
local function PlayMusic(ttype)
if ttype == 1 then
BroadcastLua([[LocalPlayer():EmitSound(']]..innowintable[math.random(1,#innowintable)]..[[')]])
elseif ttype == 2 then
BroadcastLua([[LocalPlayer():EmitSound(']]..traitorwintable[math.random(1,#traitorwintable)]..[[')]])
elseif ttype == 3 then
BroadcastLua([[LocalPlayer():EmitSound(']]..music[math.random(1,#music)]..[[')]])
end
end
hook.Add("TTTEndRound", "MyMusic", PlayMusic)[/lua][/QUOTE]
I'm going to be honest, this is terrible, terrible code. BroadcastLua? Why the fuck would you do that, If this is clientside why the fuck are you broadcasting it and your emitting a sound local player? What would be the point of that if your doing it clientside. Why are you doing elseif? What is ttype, it isn't even a defined varible that exists in the TTT Hook
Uh bro, it's a function defined argument.
[QUOTE=Llamalord;30889365]-[/QUOTE]
First of all in your code you're looping to everyone which means that the sound is going to play more then once and play different sounds secondly it's a bad way to do it, When you can use BroadcastLua, Thirdly it doesn't matter if it has to be result or ttype the function to hook it on can be anything, To get you wrong here You and jrj996 are bad coders stop coding.
jrj996 & Llamalord I don't recall any of you helping this person before I posted so get your facts right.
[QUOTE=RetTurtl3;30890305]First of all in your code you're looping to everyone which means that the sound is going to play more then once and play different sounds secondly it's a bad way to do it, When you can use BroadcastLua, Thirdly it doesn't matter if it has to be result or ttype the function to hook it on can be anything, To get you wrong here You and jrj996 are bad coders stop coding.
jrj996 & Llamalord I don't recall any of you helping this person before I posted so get your facts right.[/QUOTE]
[lua]
local function PlayMusic(WINNING_TEAM)
if WINNING_TEAM == WIN_TRAITOR then
surface.PlaySound(table.Random(traitorswin))
elseif WINNING_TEAM == WIN_INNOCENT then
surface.PlaySound(table.Random(innocentwin))
elseif WINNING_TEAM == WIN_TIMELIMIT then
surface.PlaySound(table.Random(nowin))
end
end
hook.Add("TTTEndRound","MyMusic",PlayMusic)
--or if the function isn't clientside then
local function PlayMusic(WINNING_TEAM)
umsg.Start("sendMusic")
if WINNING_TEAM == WIN_TRAITOR then
umsg.String(table.Random(traitorswin))
elseif WINNING_TEAM == WIN_INNOCENT then
umsg.String(table.Random(innocentwin))
elseif WINNING_TEAM == WIN_TIMELIMIT
umsg.String(table.Random(nowin))
end
umsg.End()
end
hook.Add("TTTEndRound","MyMusic",PlayMusic)
--In any file that has cl_ in the name.
usermessage.Hook("sendMusic",function(msg)
surface.PlaySound(msg:ReadString())
end)
[/lua]
Come at me bro, now another thing; stop acting godlike, or :smug:, out of anytime I wish flawless was still around it would be now, whip your ass into shape.
And broadcastlua isn't as effective as using usermessages.
[QUOTE=jrj996;30890821][lua]
local function PlayMusic(WINNING_TEAM)
if WINNING_TEAM == WIN_TRAITOR then
surface.PlaySound(table.Random(traitorswin))
elseif WINNING_TEAM == WIN_INNOCENT then
surface.PlaySound(table.Random(innocentwin))
elseif WIN_TIMELIMIT
surface.PlaySound(table.Random(nowin))
end
end
hook.Add("TTTEndRound","MyMusic",PlayMusic)
--or if the function isn't clientside then
local function PlayMusic(WINNING_TEAM)
umsg.Start("sendMusic")
if WINNING_TEAM == WIN_TRAITOR then
umsg.String(table.Random(traitorswin))
elseif WINNING_TEAM == WIN_INNOCENT then
umsg.String(table.Random(innocentwin))
elseif WIN_TIMELIMIT
umsg.String(table.Random(nowin))
end
umsg.End()
end
hook.Add("TTTEndRound","MyMusic",PlayMusic)
--In any file that has cl_ in the name.
usermessage.Hook("sendMusic",function(msg)
surface.PlaySound(msg:ReadString())
end)
[/lua]
Come at me bro, now another thing; stop acting godlike, out of anytime I wish flawless was still around it would be now, whip your ass into shape.
And broadcastlua isn't as effective as using usermessages.[/QUOTE]
Fail code.
Also flawless or you couldn't even fight an fly.
Aww, it's fail because it works and didn't use BroadcastLua, am sad, really, I am.
And you rate me late, um, I'm begining to think you're a little young and seem to click everywhere on the screen.
[editline]4th July 2011[/editline]
[QUOTE=RetTurtl3;30890855]
Also flawless or you couldn't even fight an fly.[/QUOTE]
What in the fuck are you talking about? Flawless was a user that got banned and would whip smug coders like you into shape.
[QUOTE=jrj996;30890870]What in the fuck are you talking about? Flawless was a user that got banned and would whip smug coders like you into shape.[/QUOTE]
Stop trolling me and get back on topic, geez you're like an kid you fight over the internet.
[QUOTE=RetTurtl3;30891851]Stop trolling me and get back on topic, geez you're like an kid you fight over the internet.[/QUOTE]
I've alerted Flawless via steam, he will be whipping you into shape ASAP.
[QUOTE=c-unitV2;30893386]I've alerted Flawless via steam, he will be whipping you into shape ASAP.[/QUOTE]
Pretty sure their is an ignore button on facepunch too. #winning
Well, everyone has their own unique ways with LUA.
Also, stop bagging on people.
Thanks to everyone who helped me :)
Resolved.
So what is the works thing? i couldn't find it :(
Sorry, you need to Log In to post a reply to this thread.