I need help, I have the code [CODE]local Music = {
[2] = { -- WIN_INNOCENT
"innocentwin.mp3"
},
[3] = { -- WIN_TRAITOR
"traitorswin.mp3"
},
[5] = { -- WIN_TIMELIMIT
"gameranoutoftime.mp3"
}
}
for k, v in pairs( Music ) do
for _, File in pairs( v ) do
resource.AddFile( "sound/"..File )
end
end
hook.Add( "TTTEndRound", "End Round Music", function( result )
local win = Music[result]
if win then
win = table.Random(win)
win = "surface.PlaySound('"..win.."')"
BroadcastLua(win)
end
end )[/CODE]
But when I restart the map it only works once. The whole game at the end of the round is silent. Could someone help me please? Also, I wan't slo-mo at the end and it don't work either :(
try dis ma nigga
[lua]
local Music = {
[ WIN_INNOCENT ] = {
"innocentwin.mp3"
},
[ WIN_TRAITOR ] = {
"traitorswin.mp3"
},
[ WIN_TIMELIMIT ] = {
"gameranoutoftime.mp3"
}
};
for k, v in pairs( Music ) do
for _, File, in pairs( v ) do
resource.AddFile( "sound/" .. File );
end
end
hook.Add( "TTTEndRound", "End Round Music", function( result )
BroadcastLua( "surface.PlaySound('" .. Music[ result ][ math.random( #Music[ result ] ) ] .. "')" );
end );[/lua]
[QUOTE=Walrus Viking;39952505]try dis ma nigga
[lua]
local Music = {
[ WIN_INNOCENT ] = {
"innocentwin.mp3"
},
[ WIN_TRAITOR ] = {
"traitorswin.mp3"
},
[ WIN_TIMELIMIT ] = {
"gameranoutoftime.mp3"
}
};
for k, v in pairs( Music ) do
for _, File, in pairs( v ) do
resource.AddFile( "sound/" .. File );
end
end
hook.Add( "TTTEndRound", "End Round Music", function( result )
BroadcastLua( "surface.PlaySound('" .. Music[ result ][ math.random( #Music[ result ] ) ] .. "')" );
end );[/lua][/QUOTE]
It does not work? :S
The thing that is missing from there is resource.AddFile("filepathhere") Try that.
If it wasn't that, post any errors that occur please.
[QUOTE=Nookyava;39955993]The thing that is missing from there is resource.AddFile("filepathhere") Try that.
If it wasn't that, post any errors that occur please.[/QUOTE]
Wrong
[lua]
for k, v in pairs( Music ) do
for _, File, in pairs( v ) do
resource.AddFile( "sound/" .. File );
end
end[/lua]
[QUOTE=mib999;39956900]Wrong
[lua]
for k, v in pairs( Music ) do
for _, File, in pairs( v ) do
resource.AddFile( "sound/" .. File );
end
end[/lua][/QUOTE]
Does this go on the end of my script or his script?
Please.. I need a fix.
[editline]18th March 2013[/editline]
It's also named in the file postroundslomo.lua
Sorry, you need to Log In to post a reply to this thread.