Modifier

Partager via


PFLobbyAddMember

Add a local user as a member to the lobby.

Syntax

HRESULT PFLobbyAddMember(  
    PFLobbyHandle lobby,  
    const PFEntityKey* localUser,  
    uint32_t memberPropertyCount,  
    const char* const* memberPropertyKeys,  
    const char* const* memberPropertyValues,  
    void* asyncContext  
)  

Parameters

lobby   PFLobbyHandle

The handle of the lobby.

localUser   PFEntityKey*

The PlayFab Entity Key of the local user to add to the lobby as a member.

memberPropertyCount   uint32_t
input in range 0,PFLobbyMaxMemberPropertyCount

The number of initial member properties to set for this user when they join the lobby.

memberPropertyKeys   char* const*
input array of size memberPropertyCount

The keys of the initial member properties to set for this user when they join the lobby.

memberPropertyValues   char* const*
input array of size memberPropertyCount

The values of the initial member properties to set for this user when they join the lobby.

asyncContext   void*
optional

An optional, app-defined, pointer-sized context value that can be used to associate the completion state change with this call.

Return value

Type: HRESULT

S_OK if the call succeeded or an error code otherwise. The human-readable form of the error code can be retrieved via PFMultiplayerGetErrorMessage().

Remarks

This is an asynchronous operation. Upon successful completion, the title will be provided a PFLobbyMemberAddedStateChange followed by a PFLobbyAddMemberCompletedStateChange with the PFLobbyAddMemberCompletedStateChange::result field set to S_OK. Upon a failed completion, the title will be provided a PFLobbyAddMemberCompletedStateChange with the PFLobbyAddMemberCompletedStateChange::result field set to a failure hresult.

This method is used to add another local PlayFab entity to a pre-existing lobby object. Because the lobby object must have already been created either via a call to PFMultiplayerCreateAndJoinLobby or PFMultiplayerJoinLobby, this method is primarily useful for multiple local user scenarios.

This is an asynchronous operation. The member added via this method will not be reflected in the lists returned by PFLobbyGetMembers until the asynchronous operation successfully completes and a PFLobbyMemberAddedStateChange struct is provided by PFMultiplayerStartProcessingLobbyStateChanges.

Requirements

Header: PFLobby.h

See also

PFLobby members