try making a new function with schedules with an if inside for stopping?
sorta like
$stop = 0;
function quack()
{
if($stop == 1)
return;
commandtoserver('messagesent', "quack");
schedule(1000, 0, quack);
}
set $stop to 1 to stop,
or
function quack()
{
cancel($quack);
commandtoserver('messagesent', "quack");
$quack = schedule(1000, 0, quack);
}
and use cancel($quack) to stop