Sign In Register

How can we help you today?

Start a new topic

Get message id on construction from cloud code

Hi,


I'm currently implementing a custom friendlist on GameSparks.
I have everything working except a tiny detail: when a player sends a friend request to another player, I dispatch a ScriptMessage to the targeted player as follow to notify somebody wants to be friend:

    //Send a friend request notification to the other player
    var friendRequestMessage = Spark.message("FriendRequestMessage");
    friendRequestMessage.setPlayerIds(friendPlayerId);
    friendRequestMessage.setMessageData({
        "senderId" : senderPlayerId
    });
    friendRequestMessage.send();

However, our player can cancel a friend request before it has been accepted.

Doing so, I remove the friend request from my database but I can't find a way to dismiss the message sent when the friend request was first made, resulting in, possibly, multiple "FriendRequestMessage" being dispatched to a client on connection if somebody add & remove somebody else multiple time.
I would like to avoid that by storing the messageId of my FriendRequestMessage and dismissing it if a player ever cancel the friend request.

I found Spark.dismissMessage(messageId) in the documentation but I can't find any way to get the messageId from the message variable constructed using Spark.message("FriendRequestMessage");


How could I achieve this result in GameSparks ?

Cheers


1 person has this question
1 Comment

same doubt here.


did you solved it?

Login to post a comment