/// <summary> /// Обработчик выхода игрока /// </summary> public void OnPlayerDisconnect(Client player, string reason) { if (player.hasData(ClanMission.BOOTY_OBJECT)) { ClanMissionManager.DetachBooty(player); } var playerInfo = _playerInfoManager.GetInfo(player); if (playerInfo == null) { return; } if (player.hasData(PlayerData.ON_RACE) || player.hasSyncedData(PlayerData.IS_REGISTERED)) { ProcessRacer(player); } SyncWork(player); SyncPrisoner(player); SyncJail(player, playerInfo); SyncWeaponAmmo(player, playerInfo); SyncClanMissionVote(player, playerInfo); playerInfo.LastPosition = PositionConverter.VectorToString(player.position); _accountsProvider.UpdateTotalTime(playerInfo.AccountId); _playersProvider.UpdatePlayersInfos(new List <PlayerInfo> { playerInfo }); _vehiclesProvider.Update(playerInfo.Vehicles.Values); _playerInfoManager.Remove(player); }
/// <summary> /// Обновить данные о метонахождении игроков /// </summary> private static void UpdatePlayersData() { foreach (var playerInfo in ServerState.Players) { var position = playerInfo.Key.position; playerInfo.Value.LastPosition = PositionConverter.VectorToString(position); } }