def _save_data_on_spawn(event): """Save the player's data when he spawns.""" if event['teamnum'] in (2, 3): player = player_from_event(event, 'userid') if player.steamid == 'BOT': return # No need to save bots on spawn, only on disconnect database.save_player(player)
def unload(): """Finalize the plugin.""" for player in wcgo.player.PlayerIter(): database.save_player(player) database.close() wcgo.entities.Hero.e_level_up -= _on_hero_level_up
def _save_data_on_disconnect(event): """Save the player's data when he disconnects.""" player = player_from_event(event, 'userid') database.save_player(player)