also I have tried using find method to get an array of all players with key-value query:
Spark.find("player", {"gameId": 210593}))
but still empty :(
Thank in advance.
Best Answer
C
Customer Support
said
over 5 years ago
Hey Andrii,
There isnt really anyway to access the player-data directly in the way you want to. This is to protect system-critical data, like the player-data that could mess the whole db up if someone added some bad data.
There are a few work-arounds though. You could use the AuthenicationRequest cloud-code event to add each player to a collection called 'playersOnline' and remove the player when they disconnect. Or, using the same cloud-code events, you could add all online player to one team, and remove them when they disconnect.
Hope that helps, -Sean
7 people have this question
1 Comment
Customer Support
said
over 5 years ago
Answer
Hey Andrii,
There isnt really anyway to access the player-data directly in the way you want to. This is to protect system-critical data, like the player-data that could mess the whole db up if someone added some bad data.
There are a few work-arounds though. You could use the AuthenicationRequest cloud-code event to add each player to a collection called 'playersOnline' and remove the player when they disconnect. Or, using the same cloud-code events, you could add all online player to one team, and remove them when they disconnect.
Andrii Voloshchuk
Hi,
does anybody know how to get all players id
Spark.getPlayerIds() is empty with length = 0.
also I have tried using find method to get an array of all players with key-value query:
Spark.find("player", {"gameId": 210593}))
but still empty :(
Thank in advance.
There isnt really anyway to access the player-data directly in the way you want to. This is to protect system-critical data, like the player-data that could mess the whole db up if someone added some bad data.
There are a few work-arounds though.
You could use the AuthenicationRequest cloud-code event to add each player to a collection called 'playersOnline' and remove the player when they disconnect.
Or, using the same cloud-code events, you could add all online player to one team, and remove them when they disconnect.
Hope that helps,
-Sean
7 people have this question
Customer Support
There isnt really anyway to access the player-data directly in the way you want to. This is to protect system-critical data, like the player-data that could mess the whole db up if someone added some bad data.
There are a few work-arounds though.
You could use the AuthenicationRequest cloud-code event to add each player to a collection called 'playersOnline' and remove the player when they disconnect.
Or, using the same cloud-code events, you could add all online player to one team, and remove them when they disconnect.
Hope that helps,
-Sean
-
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 2486 topics