Getting Player Reference on Connect and Disconnect (ValueError: Conversion from "Index" to "BaseEntity" failed)
Posted: Tue Feb 11, 2020 2:24 am
ValueError: Conversion from "Index" (1) to "BaseEntity" failed
I get this error when trying to get the player reference for a player on disconnect.
Syntax: Select all
player = Player(index)
This error seemingly only happens on map change when all players are disconnected
Normally disconnecting has no issues, I am able to get the Player reference and access the values I need to access
Is there any way to actually get a safe reference to the Player before they leave the server? I have a custom player class that is storing data that I need to reference on disconnect (it is for tracking player sessions).
Of course I could store all the necessary values in a dictionary and manage the cleanup manually, just seems a bit silly as custom Player classes otherwise accommodate this use case very well.