Sign In Register

How can we help you today?

Start a new topic
Answered

Script message expiration

Hi,

I have some messages I only want to send when the player is online. Do I achieve this, when I set expire to 0 in the message configurator?

The expire field does not exists in the documentaion at: https://docs.gamesparks.net/developer-portal/notifications


Cheers David


Best Answer
Hey David,

Yes, setting the expire-hours to '0' will send the message and then delete it. Note that the message will be deleted, and wont appear in the log if you need info from it later; just something to consider.
However, it may take a few minutes for the message to actually be deleted, so test it out and if it is taking too long, you could think about sending the messages through cloud-code.
You can check if a player is online using Spark.getPlayer()  then send out the message using SparkMessage .

Hope that helps,
Sean

Answer
Hey David,

Yes, setting the expire-hours to '0' will send the message and then delete it. Note that the message will be deleted, and wont appear in the log if you need info from it later; just something to consider.
However, it may take a few minutes for the message to actually be deleted, so test it out and if it is taking too long, you could think about sending the messages through cloud-code.
You can check if a player is online using Spark.getPlayer()  then send out the message using SparkMessage .

Hope that helps,
Sean

Hi Sean,


But leaving the expire-hours blank ensures the message never expires, right?

Thats Right

 

Thanks for the information.

Login to post a comment