Skip to content

Player.address / address_from_playerinfo unexpected return value for bots #190

@KirillMysnik

Description

@KirillMysnik

Windows, CS:GO

This is what docstring says:

Return the player's IP address and port.
If the player is a bot, an empty string will be returned.
:return: The IP address. E.g. '127.0.0.1:27015'
:rtype: str

And it's true for regular bots.

But when I try the following snippet

@OnClientActive
def listener_on_client_active(index):
    print("IP Address: {}".format(Player(index).address))

this is what is printed for just connected bots:

IP Address: 176924864
IP Address: 177622352
IP Address: 506225408
IP Address: 177475584
IP Address: 167048448
IP Address: 176134112
IP Address: 167642080
IP Address: 167835328
IP Address: 168081648
IP Address: 165674592
IP Address: 166054496
IP Address: 166136576
IP Address: 162450224
IP Address: 162537840
IP Address: 162635200

All values are integer.

So at least the docsting (and rtype) mismatches the case "we try to access bot address too early".
Though, for human players everything's fine and their actual IP address is returned. As a string.

For those who's going to look into the issue, I'd like to remind that Player.is_fake_client (not sure about Player.is_hltv) also returns False for bots in OnClientActive listener.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions