private static async Task SetSec() { await Delay(1000); if (Game.CurrentInputMode == InputMode.MouseAndKeyboard && !Menu.IsShowInput && User.GameInfo.Active) { VisiblePlayer.Clear(); foreach (var p in new PlayerList()) { if (p.ServerId == GetPlayerServerId(PlayerId())) { continue; } if (!(Main.GetDistance(GetEntityCoords(GetPlayerPed(p.Handle), true), GetEntityCoords(GetPlayerPed(-1), true)) < 20f)) { continue; } if (HasEntityClearLosToEntity(GetPlayerPed(-1), GetPlayerPed(p.Handle), 17)) { VisiblePlayer.Add(p.ServerId, true); } } } }
private static async Task SetTickShowNickname() { if (Game.CurrentInputMode == InputMode.MouseAndKeyboard && !Menu.IsShowInput && User.GameInfo.Active) { foreach (var p in new PlayerList()) { if (p.ServerId == GetPlayerServerId(PlayerId())) { continue; } if (!(Main.GetDistance(GetEntityCoords(GetPlayerPed(p.Handle), true), GetEntityCoords(GetPlayerPed(-1), true)) < 20f)) { continue; } var entity = new MyEntity(GetPlayerPed(p.Handle)); if (!VisiblePlayer.ContainsKey(p.ServerId)) { continue; } var text = p.Name; if (User.GameInfo.Active && User.GameInfo.PlayerType == PlayerTypes.Traitor) { if (p.ServerId == User.GameInfo.Traitor1) { text = $"~r~{p.Name}"; } else if (p.ServerId == User.GameInfo.Traitor2) { text = $"~r~{p.Name}"; } else if (p.ServerId == User.GameInfo.Traitor3) { text = $"~r~{p.Name}"; } else if (p.ServerId == User.GameInfo.Traitor4) { text = $"~r~{p.Name}"; } } if (User.GameInfo.Active && User.GameInfo.PlayerType == PlayerTypes.Detective) { if (p.ServerId == User.GameInfo.Detective1) { text = $"~b~{p.Name}"; } else if (p.ServerId == User.GameInfo.Detective2) { text = $"~b~{p.Name}"; } } if (NetworkIsPlayerTalking(p.Handle)) { text += "\n~b~Talking"; } DrawText3D(entity.Position + new Vector3(0, 0, 0.6f), text); } } }
private static async Task SecTimer() { await Delay(1000); UI.CurrentOnline = new PlayerList().Count(); SetWeatherTypePersist(User.MapInfo.Weather); SetWeatherTypeNowPersist(User.MapInfo.Weather); SetWeatherTypeNow(User.MapInfo.Weather); SetOverrideWeather(User.MapInfo.Weather); if (User.GameInfo.Active) { if (User.GameInfo.CamType == 0) { if (GetFollowPedCamViewMode() != 4) { SetFollowPedCamViewMode(4); } } else { if (GetFollowPedCamViewMode() != 1) { SetFollowPedCamViewMode(1); } } } if (User.GetStatusType() == StatusTypes.InGame || User.GetStatusType() == StatusTypes.Briefing) { var playerPos = GetEntityCoords(GetPlayerPed(-1), true); if (Main.GetDistance(playerPos, new Vector3((float)User.MapInfo.CenterX, (float)User.MapInfo.CenterY, (float)User.MapInfo.CenterZ)) > (float)User.MapInfo.MaxRadius || !User.MapInfo.CanSwim && (IsPedSwimming(GetPlayerPed(-1)) || IsPedSwimmingUnderWater(GetPlayerPed(-1)))) { float spawnX = (float)await Sync.Data.Get(User.GetServerId(), "spawnPosX"); float spawnY = (float)await Sync.Data.Get(User.GetServerId(), "spawnPosY"); float spawnZ = (float)await Sync.Data.Get(User.GetServerId(), "spawnPosZ"); User.Teleport(new Vector3(spawnX, spawnY, spawnZ)); } if (IsEntityDead(GetPlayerPed(-1))) { NetworkSetVoiceChannel(1); Sync.Data.Set(User.GetServerId(), "isDead", true); if (!NetworkIsInSpectatorMode()) { User.SetStatusType(StatusTypes.Spectator); } } } if (User.GetStatusType() == StatusTypes.Lobby) { if (await Sync.Data.Has(-1, "GameTimer")) { var t = TimeSpan.FromSeconds((int)await Sync.Data.Get(-1, "GameTimer")); Screen.LoadingPrompt.Show($"Wait new game: {t.Minutes}:{t.Seconds:d2}"); await Delay(4000); } else if (await Sync.Data.Has(-1, "BriefingTimer")) { Screen.LoadingPrompt.Show("Wait new game..."); await Delay(4000); } else { Sync.Data.Set(User.GetServerId(), "Lobby", true); if (User.LobbyInfo.CountPlayers < 2) { Screen.LoadingPrompt.Show($"Wait more players... {User.LobbyInfo.CountPlayers}/2"); Sync.Data.Set(-1, "StartTimer", 121); } else if (Screen.LoadingPrompt.IsActive) { Screen.LoadingPrompt.Hide(); } } } if (User.GetStatusType() == StatusTypes.Spectator) { if (IsEntityDead(GetPlayerPed(User.GetSpecLast()))) { User.SetStatusType(StatusTypes.Spectator); await Delay(5000); } } }