how to stop this timer loop?

function StartClub ( )
for k, v in pairs(Emitters) do
WorldSound(“Test.mp3”, v, 100, 100);
end;
timer.Simple(23.5, StartClub);

How do i stop that timer?

timer.Simple() only runs once.
But you’re missing an end.

On the server it keeps looping

[lua]function StartClub ( )
for k, v in pairs(Emitters) do
WorldSound(“Test.mp3”, v, 100, 100);
end
end
timer.Simple(23.5, StartClub)
[/lua]

Will do it once, after 23.5 seconds.

[lua]function StartClub ( )
for k, v in pairs(Emitters) do
WorldSound(“Test.mp3”, v, 100, 100);
end
timer.Simple(23.5, StartClub)
end
[/lua]
Is the code so its looping wich i want, i also want function stopclub that stops the loop. How?

[lua]function StartClub ( )
for k, v in pairs(Emitters) do
WorldSound(“Test.mp3”, v, 100, 100);
end
end
function StopClub()
timer.Destroy(“ClubMusic”);
end

timer.Create(“ClubMusic”,23.5, 0, StartClub);
[/lua]

Try that.

Thank you i try thomorrow im going to sleep now :3

Good luck!

You created a timer but youre not letting it start?

I did start it
timer.Create(). Starts itself.

And does it keeps looping on timer end? And can be reran on stop should i move timercreate between the stops of the start function?

It creates and removes the timer each time you start and stop it.

its not working :(. the StartClub function is triggered by a command, and plays a sound file that is 23.5 long. if that time is over, it restarts the function to play it again and restart that timer again. so how do i make it work that i can also break the timer with a command
[lua]

timer.Create(“ClubMusic”,23.5, 1, StartClub)

function StartClub ( )
for k, v in pairs(Emitters) do
WorldSound(“Test.mp3”, v, 100, 100)
end
timer.Start(“ClubMusic”)
end
function StopClub()
timer.Stop(“ClubMusic”)
end

concommand.Add(“disco_start”, StartClub)
concommand.Add(“disco_stop”, StopClub)
[/lua]

i got that now, the on start command the music starts playing but it isn’t looping

timer.Create(“ClubMusic”,23.5, 1, StartClub)

Put it below the functions.

its working, thanks

You’re welcome :). Don’t hesitate to post a new thread, or send me a PM here if you’ve got any more questions.