Event.GetPendingEventCount
Skip to content
mnscript
number Event.GetPendingEventCount() 

Description ​

Gets the number of pending events.

Returns ​

number

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();
}