Sign In Register

How can we help you today?

Start a new topic
Answered

Number of all players

Hi,

I'm very new to gamesparks and sorry if my question is ridiculous.


In my game I need to know how many players already registered in game, how can I get number of all registered players?


Best Answer

Hi Sina,


To track the count of all registered players you would need to create a custom data type as there is no way to access the player collections via cloud code. 


To do this you would create a data type for example called registeredPlayers with an index of registeredCount and each time a new player is registered successfully update the count by one. You will also need to decrease the registeredCount by 1 if a player is deleted. After this you will be able to query Game Data Services and get the value for the registered count and be able to use it for your game. For more information on creating custom data types follow the link here.


I hope this answers your question if you have any more issues please let us know.


Regards,

Garreth.

1 Comment

Answer

Hi Sina,


To track the count of all registered players you would need to create a custom data type as there is no way to access the player collections via cloud code. 


To do this you would create a data type for example called registeredPlayers with an index of registeredCount and each time a new player is registered successfully update the count by one. You will also need to decrease the registeredCount by 1 if a player is deleted. After this you will be able to query Game Data Services and get the value for the registered count and be able to use it for your game. For more information on creating custom data types follow the link here.


I hope this answers your question if you have any more issues please let us know.


Regards,

Garreth.


1 person likes this
Login to post a comment