question

Abdullah Sohail avatar image
Abdullah Sohail asked

How can we bound a player to be a member of only one group at a time ?

10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

1 Answer

·
Rick Chen avatar image
Rick Chen answered

You could use the ListMembership API to check if a user has already been a member of a group. If yes and the user wants to join another group, you can remove the user from the previous group first, then add him to the new group.

4 comments
10 |1200

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Abdullah Sohail avatar image Abdullah Sohail commented ·

From your answer, what I understand is like if ListMembership API response contains empty list of Groups, than that means a player is not a member of any group and is allowed to join any group. But if the Groups list contain any member, player is not allowed to join any group until he leave the previous one. Am I right @Rick Chen?

0 Likes 0 ·
Rick Chen avatar image Rick Chen ♦ Abdullah Sohail commented ·

The player is always allowed to join multiple groups, even if ListMembership API returns a list of groups that the player is in. It is up to you to control how player joins a group. If you would like that a player can only be a member of one group at a time, you could implement what I said previously. Please check the available group API for removing members from or adding members to a group.

0 Likes 0 ·
Abdullah Sohail avatar image Abdullah Sohail Rick Chen ♦ commented ·

Ok. Didn't get it exactly but thank you so much.

0 Likes 0 ·
Show more comments

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.