Sign In Register

How can we help you today?

Start a new topic

SparkMatch.getParticipants error in cloud code???!!!!

inside of MatchDetailsResponse,MatchDetailsRequest,MatchFoundMessage(global and user both) i am trying to get participants list by :


var participantList=SparkMatch.getParticipants();

but always getting error on that line.
why?

i need to send some instruction to each of the participants. how to get the id of those participate players?

1 Comment

  

Spark.getData().participants

   

Will give you access to the array of participants of type 'Player'. 


  

Spark.getData().participants[0].id

 

Will return you the id of the first player, you will need to create a foreach loop to return the id of every player.


Also SparkMatch is a type, you're simply calling a function from a type - similar to having Array.concat.


Hope this helps,

Omar

Login to post a comment