How to check if player in MPP is unnactive?

41 views
Skip to first unread message

LGPvS

unread,
Nov 20, 2018, 5:16:14 AM11/20/18
to Multiplayer Piano Forum
How to check if player in MPP is unnactive or afk? Example if somewho is unactive, in chat sending a "NMPB Ray890 is unnactive".

Lamp

unread,
Nov 20, 2018, 1:18:28 PM11/20/18
to Multiplayer Piano Forum
var idleTimeout = 1000 * 60 * 15; // 15 minutes
var participantTimeouts = {};
function onParticipantActivity(participant) {
    if (participantTimeouts[participant.id]) {
         clearTimeout
(participantTimeouts[participant.id]);
    } else {
         console
.log(participant.name, "is no longer AFMPP");
   
}
    participantTimeouts
[participant.id] = setTimeout(onParticipantInactivity, idleTimeout, participant);
}
function onParticipantInactivity(participant) {
    participantTimeouts
[participant.id] = undefined;
    console
.log(participant.name, "is now AFMPP");
}
MPP
.client.on("a", msg => { // chat
    onParticipantActivity
(msg.p);
});
MPP
.client.on("m", msg => { // mouse
    onParticipantActivity
(MPP.client.ppl[msg.id]);
});
MPP
.client.on("n", msg => { // notes
   
onParticipantActivity(MPP.client.ppl[msg.p]);
});

LGPvS

unread,
Nov 21, 2018, 6:10:33 AM11/21/18
to mpp-...@googlegroups.com
Bug: its says that player is not active, even if him typing in chat

вторник, 20 ноября 2018 г., 23:18:28 UTC+5 пользователь Lamp написал:
Reply all
Reply to author
Forward
0 new messages