To stop a schedule, give it a variable name, such as %client.jazzloop = schedule(...);
Then, to stop it, you can use
if(isEventPending(%client.jazzloop)) //checks if the schedule exists
{
cancel(%client.jazzloop); //terminates the schedule
}
Thank you, I actually just wrote/tested a stopping method but is has simple issue
package HungerMain
{
function servercmdStartLoopJazZ(%client)
{
if(%client.isSuperAdmin || %client.isAdmin)
{
$LoopActivation = 1;
schedule(500, 0, RelayLoopJazZ, %client);
}
else
{
messageClient(%client,"","\c6 Your Not Admin");
}
}
function servercmdStopLoopJazZ(%client)
{
if(%client.isSuperAdmin || %client.isAdmin)
{
$LoopActivation = 0;
schedule(500, 0, RelayLoopJazZ, %client);
}
else
{
messageClient(%client,"","\c6 Your Not Admin");
}
}
};
activatepackage(HungerMain);
function RelayLoopJazZ(%client)
{
if($LoopActivation == 1)
{
messageClient(%client,"","\c6 Worked.");
schedule(500, 0, RelayLoopJazZ, %client);
}
else
{
messageClient(%client,"","\c6 Loop Stopped.");
}
}
That code works with no syntax errors at all, but when I use /StopLoopJazZ it displays "Loop Stopped." twice, any way I can prevent this?