private async Task OnTick() { var hud = HeadupDisplay.GetModule(); if (!hud.IsDisabled) { var ped = API.PlayerPedId(); var anchor = hud.GetMinimapAnchor(); ScreenInterface.DrawText( $"Tonläge: {(API.NetworkIsPlayerTalking(API.PlayerId()) ? "~b~" : "")}{Translate()}", 0.25f, !API.IsPedSittingInAnyVehicle(ped) ? new Vector2(anchor.X + 0.0005f, (float)(anchor.BottomY - anchor.UnitY * 18f / 2 / 2) - anchor.UnitY * 18f * 2 - 0.0005f) : new Vector2(anchor.X + anchor.Width + 0.001f, (float)(anchor.BottomY - anchor.Height / 2)), Color.FromArgb(200, 200, 200, 200)); if (Game.IsControlPressed(0, Control.Sprint) && Game.IsControlJustPressed(0, Control.VehicleHeadlight)) { IterateRange(); } } await Task.FromResult(0); }
private async Task OnTick() { var player = Cache.Player; var entity = Cache.Entity; if (entity.IsDead) { WasDead = true; if (Timestamp < 1) { player.DisableHud(); Timestamp = Date.Timestamp; } var timeLeft = new TimeSpan(Date.TimestampToTicks(Timestamp + 1000 * 60 * 20 - Date.Timestamp)); ScreenInterface.DrawText( timeLeft.Ticks > 1 ? $"Du är medvetslös. ({timeLeft.Minutes}:{timeLeft.Seconds})" : "Du är medvetslös. (Tryck E för att återuppstå vid sjukhuset)", 0.3f, new Vector2(0.5f, 0.75f), Color.FromArgb(175, 175, 175), true); if (Game.IsControlJustPressed(0, Control.DropWeapon)) { API.ClearPedTasksImmediately(entity.Id); } if (timeLeft.Ticks < 1 && Game.IsControlJustPressed(0, Control.Context) && InterfaceManager.GetModule().MenuContext == null) { API.DoScreenFadeOut(0); player.Character.Revive(new Position(319.6946f, -573.5911f, 43.31747f, 231.9435f)); ItemHelper.RemoveAll(InventoryManager.GetModule().GetContainer("equipment_inventory"), self => true); ItemHelper.RemoveAll(InventoryManager.GetModule().GetContainer("pockets_inventory"), self => true); await BaseScript.Delay(3000); API.DoScreenFadeIn(3000); } await Task.FromResult(0); } else { if (WasDead) { Timestamp = 0; player.EnableHud(); } await BaseScript.Delay(1000); } }
private async Task OnTick() { var player = Cache.Player; if (player?.Entity != null && API.IsPedSittingInAnyVehicle(player.Entity.Id)) { var entity = Cache.Entity; var anchor = GetMinimapAnchor(); ScreenInterface.DrawText( $"KM/H: {Math.Ceiling(API.GetEntitySpeed(API.GetVehiclePedIsIn(entity.Id, false)) * 3.6)}", 0.25f, new Vector2(anchor.X + anchor.Width + 0.001f, (float)(anchor.BottomY - anchor.Height / 2) - 0.025f), Color.FromArgb(200, 200, 200, 200)); } await Task.FromResult(0); }