Event.ClearEvents
Skip to content
mnscript
Event.ClearEvents() 

Description ​

Clears the queue of pending events.

Example ​

msc
using Event;

// This is useful to mitigate DDoS attempts to your script.
// If someone is spamming net messages to your program, you can detect this
// by counting the pending events, and clear the events.

number pendingEvents = Event.GetPendingEventCount();

if(pendingEvents > 50){
    // This is quite a lot of events, and might be caused by someone spamming net messages to us.
    Event.ClearEvents();
}