Sign In Register

How can we help you today?

Start a new topic

drop out a player in RTSession

How can I drop out a player in RTSession using peerID?


You can use a combo of getting player ID through Peer ID and invoking a log event request onbehalf of the player that removes them from the session.

Something like this:

in RTScript:

var matchID = RTSession.getSessionId(); //Gets Match Instance ID

var playerID = RTSession.getPlayer(peerId).getPlayerId(); //get player ID

var request = RTSession.newRequest().createLogEventRequest().setEventKey("Event_Name_You_Specify");

request.setmatchID(matchID);     // Make sure log event has string attribute with same shortcode

request.setPlayerId(playerID).send(function(response){             RTSession.getLogger().debug(response);         });

Log event cloud code:

var matchID = Spark.getData().matchID;


With this combo you should achieve it.



Cannot remove players from an in progress drop in drop out match. Use Spark.getMultiplayer().cancelMatchmaking() instead. (event/discon.js#5)

.removePlayers not work. I try cancelMatchmaking but it is not drop out instantly. Have a any way for this?


Login to post a comment