You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defis_player_authorized(self, index, permission):
"""Return True if the player has been granted the given permission. :rtype: bool """returnpermissioninself.get_player_permissions(index)
defget_player_permissions_from_steamid(self, steamid):
"""Return the permissions of a player. :param str/int steamid: The SteamID2, SteamID3 or SteamID64 of a player. :return: If the given SteamID is invalid (e.g. 'BOT'), None will be returned. :rtype: PlayerPermissions """try:
returnself.players[steamid]
exceptValueError:
returnNone
See, get_player_permissions_from_steamid (and thus get_player_permissions) can return None. But in that case the following line in is_player_authorized:
will raise TypeError: argument of type 'NoneType' is not iterable
Possible solution
defis_player_authorized(self, index, permission):
"""Return True if the player has been granted the given permission. :rtype: bool """permissions=self.get_player_permissions(index)
ifpermissionsisNone:
returnFalsereturnpermissioninpermissions
The text was updated successfully, but these errors were encountered:
Problem
is_player_authorized
get_player_permissions
get_player_permissions_from_steamid
See,
get_player_permissions_from_steamid
(and thusget_player_permissions
) can returnNone
. But in that case the following line inis_player_authorized
:will raise
TypeError: argument of type 'NoneType' is not iterable
Possible solution
The text was updated successfully, but these errors were encountered: