I have code:
Code: Select all
from players.dictionary import PlayerDictionary
from players.entity import Player
class CustomPlayer(Player):
points = 0
def has_c4(self):
pass
def create_player(index: int) -> CustomPlayer:
player = CustomPlayer(index)
return player
players = PlayerDictionary(create_player)
Actions:
1) Join server
2) Add bot with tf_bot_add
3) Leave server (After leaving, the bot is kicked)
Errors in the console:
Code: Select all
Client "Player" connected (192.168.133.1:27006).
Server waking up from hibernation
tf_bot_add
NextBot tickrate changed from 0 (0.000ms) to 7 (0.105ms)
[Source.Python]
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\packages\source-python\entities\_base.py", line 133, in __call__
obj = super().__call__(index)
File "..\addons\source-python\packages\source-python\entities\_base.py", line 229, in __init__
BaseEntity.__init__(self, index)
ValueError: Conversion from "Index" (1) to "BaseEntity" failed.
Dropped Player from server (Client Disconnect)
Server is hibernating
[Source.Python]
[SP] Caught an Exception:
Traceback (most recent call last):
File "..\addons\source-python\packages\source-python\entities\_base.py", line 133, in __call__
obj = super().__call__(index)
File "..\addons\source-python\packages\source-python\entities\_base.py", line 229, in __init__
BaseEntity.__init__(self, index)
ValueError: Conversion from "Index" (2) to "BaseEntity" failed.
Dropped The G-Man from server (Punting bot, server is hibernating)
Manual bot kick also raise error.