This can be accessed in both Global Message Scripts and User Message Scripts
So I Think it is way it returns empty array in other context.
you can't use it to send message to all players in database.You can use it in cloud code messagesscripts to easly access target players of given message.
It is only valid when you are using it for Global Messages, it is not valid in any other context.
D
Davendra Jayasingam
said
over 7 years ago
I'm trying to use it in that context. How do I then send a message to all players?
Spark.sendMessage({"a":"b"}, Spark.?);
Since send message needs a SparkPlayer object, I can use Spark.loadPlayer(playerId), but I need to get all the player ids first. Any thoughts?
F
Friedrich Wessel
said
over 7 years ago
I would also like to know this. Thanks for your help!
Z
Zbigniew Zajac
said
over 7 years ago
Answer
from documentation of Spark.getPlayerIds
This can be accessed in both Global Message Scripts and User Message Scripts
So I Think it is way it returns empty array in other context.
you can't use it to send message to all players in database.You can use it in cloud code messagesscripts to easly access target players of given message.
Customer Support
said
over 7 years ago
The best way to go about messaging all players at the moment is to maintain a separate runtime collection of playerId's and query that. You can do this multiple ways, create an event that adds the user's id to the Database, add it in Registration Request or add it in Authentication Request.
Davendra Jayasingam
Any idea why?
from documentation of Spark.getPlayerIds
This can be accessed in both Global Message Scripts and User Message Scripts
So I Think it is way it returns empty array in other context.
you can't use it to send message to all players in database.You can use it in cloud code messages scripts to easly access target players of given message.
- Oldest First
- Popular
- Newest First
Sorted by Oldest FirstGreg Quinn
In what context are you trying to use it?
It is only valid when you are using it for Global Messages, it is not valid in any other context.
Davendra Jayasingam
I'm trying to use it in that context. How do I then send a message to all players?
Since send message needs a SparkPlayer object, I can use Spark.loadPlayer(playerId), but I need to get all the player ids first. Any thoughts?
Friedrich Wessel
I would also like to know this. Thanks for your help!
Zbigniew Zajac
from documentation of Spark.getPlayerIds
This can be accessed in both Global Message Scripts and User Message Scripts
So I Think it is way it returns empty array in other context.
you can't use it to send message to all players in database.You can use it in cloud code messages scripts to easly access target players of given message.
Customer Support
The best way to go about messaging all players at the moment is to maintain a separate runtime collection of playerId's and query that. You can do this multiple ways, create an event that adds the user's id to the Database, add it in Registration Request or add it in Authentication Request.
Shane
-
Documentation Notes
-
Design issues with user events
-
Using NoSQL
-
Runtime Collections vs Metadata Collections
-
Anonymous authentication from browser app
-
Modules
-
Movement With Unity
-
Problem with url parameters for downloadables
-
Querying NoSql GameSparks database
-
Challenge accesType
See all 2487 topics