ACR_ServerCommunicator.ACR_ServerCommunicator.TryGetPlayerState C# (CSharp) Method

TryGetPlayerState() public method

Look up the player state for a player in the internal lookup table.
public TryGetPlayerState ( uint PlayerObjectId ) : PlayerState
PlayerObjectId uint Supplies the PC object id to look up. ///
return PlayerState
        public PlayerState TryGetPlayerState(uint PlayerObjectId)
        {
            PlayerState RetPlayerState;

            if (GetIsPC(PlayerObjectId) != TRUE)
                PlayerObjectId = GetOwnedCharacter(PlayerObjectId);

            if (!PlayerStateTable.TryGetValue(PlayerObjectId, out RetPlayerState))
                return null;
            else
                return RetPlayerState;
        }

Usage Example

        /// <summary>
        /// This method is called when the ClientEnter event fires for a
        /// player.  Its purpose is to check whether the player has a pending
        /// resync request, and, if so, to execute the resync operation.
        /// </summary>
        /// <param name="State">Supplies the player object of the incoming
        /// player.</param>
        /// <param name="Script">Supplies the script object.</param>
        public static void OnClientEnter(uint PCObject, ACR_ServerCommunicator Script)
        {
            PlayerState State = Script.TryGetPlayerState(PCObject);

            if (State == null)
            {
                return;
            }

            var ResyncInfo = (from RS in PlayerResyncStates
                              where RS.PlayerId == State.PlayerId
                              select RS).FirstOrDefault();

            if (ResyncInfo == null)
            {
                return;
            }

            //
            // Dequeue the resync state and start attempting to apply it to the
            // player object once the player has loaded.
            //

            PlayerResyncStates.Remove(ResyncInfo);
            ResynchronizePlayerState(ResyncInfo, PCObject, Script);
        }
All Usage Examples Of ACR_ServerCommunicator.ACR_ServerCommunicator::TryGetPlayerState
ACR_ServerCommunicator