Add a notification in the chat when someone is kicked for being AFK

This commit is contained in:
Beu 2023-07-12 16:02:22 +02:00
parent 057800e992
commit c786f79f57

View File

@ -152,6 +152,14 @@ foreach (Event in PendingEvents) {
} }
} }
foreach (Event in UIManager.PendingEvents) {
if (Event.CustomEventType == "LMS_NotifyAFK") {
if (Event.CustomEventData.count > 0) {
UIManager.UIAll.SendChat("$ff9" ^ Event.CustomEventData[0] ^ " has been kicked for being AFK");
}
}
}
StateMgr::Yield(); StateMgr::Yield();
*** ***
@ -953,6 +961,8 @@ Void SetML() {
// Check if player is AFK or not // Check if player is AFK or not
if (Last_AFKIdleTime > 0 && Input.TimeSinceLatestActivity > Last_AFKIdleTime) { if (Last_AFKIdleTime > 0 && Input.TimeSinceLatestActivity > Last_AFKIdleTime) {
log("Player is AFK"); log("Player is AFK");
SendCustomEvent("LMS_NotifyAFK", [InputPlayer.User.Name]);
sleep(200); // Ensure that the Event is send to the server before leaving
Playground.QuitServer(False); Playground.QuitServer(False);
} else if (Last_AFKIdleTime > 0 && Input.TimeSinceLatestActivity > Last_AFKDisplayTime) { } else if (Last_AFKIdleTime > 0 && Input.TimeSinceLatestActivity > Last_AFKDisplayTime) {
Frame_Global.Visible = True; Frame_Global.Visible = True;