Sign In Register

How can we help you today?

Start a new topic

Determine if a TeamChatMessage cannot be delivered to a disconnected player.

I noticed that players receive a TeamChatMessage if they are online. Presumably, the cloud code script for User Message > TeamChatMessage will fire once for each user that the server 'thinks' is online. But, is there a way to know if the message is not received (because they are actually not online anymore) and have the cloud code update their online status?

1 Comment

Hi James,


You can't update a players online status, this will be determined by the platform. You can use the following to check if the current player is online, the second will check if a specific player is online.

 

//is the current player online
var online = Spark.getPlayer().isOnline();

//check if another player is online
var playerOnline = Spark.loadPlayer(playerId).isOnline()

 

So you could check if the player is online in the messages Cloud Code and send some sort of response back to the original sender of the message or update their in game UI. Does that sound like it might work for you ? 


Thanks,

Liam

Login to post a comment