Sign In Register

How can we help you today?

Start a new topic

Cancel Pending Match?

Hey there,


so I looked a bit throug the forum to find information about MatchMaking a premade team.

People suggested using "Spark.getMatchConfig(ShortCode).createPendingMatch(...)".
Now while this works, how do I actually cancel this?

For a single "MatchMakingRequest", I simply do this: 


 

//Get MatchShortCode
var MatchShortCode = Spark.getData().matchShortCode;

// Create new MatchRequest
var MatchRequest = new SparkRequests.MatchmakingRequest();

// Fill in ShortCode and Skill
MatchRequest.matchShortCode = MatchShortCode;
MatchRequest.action = "cancel";

// Send the Request
MatchRequest.Send();

 But how do I stop the pendingMatch of the whole group?
I tried getting the PendingMatch by loading it based on the Leaders PlayerID.

 

// Passed Variables
var ShortCode = Spark.getData().shortCode;
var ThisPlayer = Spark.getPlayer();

var Match = Spark.getMultiplayer().loadPendingMatchByPlayer(ThisPlayer, ShortCode, "group1");

 And from that I would like to get the PlayerIDs to let them call "cancelMatchMaking".
But I have a hard time accessing these.

Any hints?



Hi Cedric,


To do it for a team you'll likely have to create a loop to do it for each team member. You can cancel match making for a player with this SparkMultiPlayer call. You could also use a SparkRequest and send the MatchMakingRequest as each player with the action set to "cancel" to achieve this.


Regards,

Liam

:P I already wrote that I would like to call "cancelMatchmaking". I do already know about the function.
I wrote at the end of my post that I have trouble accessing/finding the Team Players IDs from the Pending Match.

Login to post a comment