function hatLoop(%client, %ov) calls these lines immediately
schedule(1000, 0, syncHatList, %client);
%client.hatLoop = schedule($RMhatmod::LoopTime * 60000, 0, hatLoop, %client);
Then if either $RMHatMod::Loop or $RMHatMod::FH is false it will call the same two lines again, causing a multiplying schedule loop that will eventually lag out the server. I am forced to fail this add-on by CRC.
Here is one way to avoid this sort of problem: Every time you go to schedule something, store the scheduled event in a variable, then if you want to reschedule it, cancel the old event first. Like this:
if(isEventPending(%client.hatLoop))
{
cancel(%client.hatLoop);
%client.hatLoop = 0;
}
%client.hatLoop = schedule($RMhatmod::LoopTime * 60000, 0, hatLoop, %client);
You should do something similar the syncHatList loop and any other schedule loops you are creating.