def address_from_playerinfo(playerinfo): """Return the IP address for the given player. If the player is a bot, an empty string will be returned. :param PlayerInfo playerinfo: The PlayerInfo instance to get the UniqueID from. :return: The IP address. E.g. '127.0.0.1:27015' :rtype: str """ # Is the player a bot? if playerinfo.is_fake_client(): # Return an empty string, since using <netinfo>.address crashes # with bots return '' # Get the player's index index = index_from_playerinfo(playerinfo) # Get the player's NetInfo instance netinfo = engine_server.get_player_net_info(index) # Return the player's IP Address return netinfo.address
def address_from_playerinfo(playerinfo): """Return the IP address for the given player. If the player is a bot, an empty string will be returned. :param PlayerInfo playerinfo: The PlayerInfo instance to get the UniqueID from. :return: The IP address. E.g. '127.0.0.1:27015' :rtype: str """ # Is the player a bot? if playerinfo.is_fake_client() or 'BOT' in playerinfo.steamid: # Return an empty string, since using <netinfo>.address crashes # with bots return '' # Get the player's index index = index_from_playerinfo(playerinfo) # Get the player's NetInfo instance netinfo = engine_server.get_player_net_info(index) # Return the player's IP Address return netinfo.address
def net_info(self): """Return the player's network channel information. :return: ``None`` if no network channel information exists. E. g. if the player is a bot. :rtype: NetChannelInfo """ return engine_server.get_player_net_info(self.index)
def address_from_playerinfo(playerinfo): """Return the IP address for the given player.""" # Is the player a bot? if playerinfo.is_fake_client(): # Return a base value, since using # <netinfo>.get_address() crashes with bots return "0" # Get the player's index index = index_from_playerinfo(playerinfo) # Get the player's NetInfo instance netinfo = engine_server.get_player_net_info(index) # Return the player's IP Address return netinfo.get_address()