public static void DrawDashcam(DashVehicle vehicle, bool draw) { if (draw) { veh = vehicle; GetDate(dateForm); unit = vehicle.GetUnit(); for (int i = 0; i < Configs.confVehs.Length; i++) { uint vehHash = veh.Model.Hash; if (vehHash == StringToHash(Configs.confVehs[i].ToLower())) { department = Configs.confDepName[i]; acronym = Configs.confDepAbrv[i]; colR = Int32.Parse(Configs.confDepNameR[i]); colG = Int32.Parse(Configs.confDepNameG[i]); colB = Int32.Parse(Configs.confDepNameB[i]); break; } else { if (i == Configs.confVehs.Length - 1) { department = "Generic Department"; acronym = "GD"; colR = 255; colG = 255; colB = 255; } } } if (filter) { NativeFunction.CallByHash <uint>(0x2C933ABF17A1DF41, "phone_cam2"); } if (layout == 1 && !eventOn) { InitializeDashcam(1); eventOn = true; } else if (!eventOn) { InitializeDashcam(0); eventOn = true; } isDashOn = true; } else { if (isDashOn) { if (filter) { NativeFunction.CallByHash <uint>(0x0F07E7745A236711); } if (eventOn) { if (layout == 1) { Game.FrameRender -= OnFrameRenderLayout2; } else { Game.FrameRender -= OnFrameRenderLayout1; } eventOn = false; } isDashOn = false; } } }
public static void Main() { DashVehicle activVeh = null; bool state = false; bool lastSirenState = false; Configs.RunConfigCheck(); cam.Delete(); while (true) { if (cam.IsValid() && Game.LocalPlayer.Character.LastVehicle.Exists()) { cam.Rotation = Game.LocalPlayer.Character.LastVehicle.Rotation; cam.FOV = NativeFunction.CallByHash <float>(0x65019750A0324133); } if (Game.LocalPlayer.Character.LastVehicle.Exists()) { if (Game.LocalPlayer.Character.LastVehicle.IsDead) { if (cam.IsValid()) { if (cam.Active) { dashView = false; state = false; cam.Delete(); } } } if (state) { DashHelper.DrawDashcam((DashVehicle)Game.LocalPlayer.Character.LastVehicle, true); } } if (Game.LocalPlayer.Character.CurrentVehicle == null && Game.LocalPlayer.Character.LastVehicle != null && !Game.LocalPlayer.Character.LastVehicle.IsDead && Game.LocalPlayer.Character.LastVehicle.Exists() && ((DashVehicle)Game.LocalPlayer.Character.LastVehicle).CheckIfEmergencyVehicle() && (((Control.ModifierKeys & Keys.Shift) != 0 && Game.IsKeyDown(Configs.remoteViewKey)) || Game.IsControllerButtonDown(Configs.remoteViewBut))) { if (!state) { lastSirenState = Game.LocalPlayer.LastVehicle.IsSirenSilent; cam = new Camera(true); Game.LocalPlayer.LastVehicle.IsSirenSilent = true; ((DashVehicle)Game.LocalPlayer.Character.LastVehicle).SetDashview(cam); cam.Rotation = Game.LocalPlayer.Character.LastVehicle.Rotation; cam.FOV = NativeFunction.CallByHash <float>(0x65019750A0324133); state = true; } else { cam.Delete(); Game.LocalPlayer.LastVehicle.IsSirenSilent = lastSirenState; state = false; } } if (dashView && Game.IsControlJustPressed(0, GameControl.Enter)) { if (cam.IsValid()) { if (cam.Active) { dashView = false; cam.Delete(); } } } else if (dashView && !NativeFunction.CallByHash <bool>(0x70FDA869F3317EA9) && !cam.IsValid()) { cam = new Camera(true); ((DashVehicle)Game.LocalPlayer.Character.LastVehicle).SetDashview(cam); cam.Rotation = Game.LocalPlayer.Character.LastVehicle.Rotation; cam.FOV = NativeFunction.CallByHash <float>(0x65019750A0324133); } else if (NativeFunction.CallByHash <bool>(0x39B5D1B10383F0C8) || NativeFunction.CallByHash <bool>(0x70FDA869F3317EA9)) { if (dashView) { if (cam.IsValid()) { if (cam.Active) { cam.Delete(); } } } if (DashHelper.dashAllViews && Game.LocalPlayer.Character.CurrentVehicle != null && ((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle).CheckIfEmergencyVehicle() && (!(Game.LocalPlayer.Character.CurrentVehicle.Position.X > 366 && Game.LocalPlayer.Character.CurrentVehicle.Position.X < 426 && Game.LocalPlayer.Character.CurrentVehicle.Position.Y > -1000 && Game.LocalPlayer.Character.CurrentVehicle.Position.Y < -940 && Game.LocalPlayer.Character.CurrentVehicle.Position.Z > -129 && Game.LocalPlayer.Character.CurrentVehicle.Position.Z < -69))) { DashHelper.DrawDashcam((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle, true); } else { DashHelper.DrawDashcam(null, false); } } else if (Game.LocalPlayer.Character.CurrentVehicle != null && ((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle).CheckIfEmergencyVehicle()) { if (!(Game.LocalPlayer.Character.CurrentVehicle.Position.X > 366 && Game.LocalPlayer.Character.CurrentVehicle.Position.X < 426 && Game.LocalPlayer.Character.CurrentVehicle.Position.Y > -1000 && Game.LocalPlayer.Character.CurrentVehicle.Position.Y < -940 && Game.LocalPlayer.Character.CurrentVehicle.Position.Z > -129 && Game.LocalPlayer.Character.CurrentVehicle.Position.Z < -69)) { if (Game.IsControlJustReleased(0, GameControl.NextCamera)) { if (!dashView && NativeFunction.CallByHash <int>(0xA4FF579AC0E3AAAE) == 4) { dashView = true; cam = new Camera(true); ((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle).SetDashview(cam); cam.Rotation = Game.LocalPlayer.Character.CurrentVehicle.Rotation; cam.FOV = NativeFunction.CallByHash <float>(0x65019750A0324133); activVeh = (DashVehicle)Game.LocalPlayer.Character.CurrentVehicle; } else if (dashView) { dashView = false; cam.Delete(); NativeFunction.CallByHash <uint>(0xAC253D7842768F48, 4); } } if (state) { state = false; if (cam.IsValid()) { if (cam.Active) { cam.Delete(); } } } if (dashView) { DashHelper.DrawDashcam((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle, true); } } else { DashHelper.DrawDashcam(null, false); } } else if (Game.LocalPlayer.Character.CurrentVehicle == null && !state) { if (cam.IsValid()) { if (cam.Active) { dashView = false; cam.Delete(); } } } if ((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle != activVeh && (DashVehicle)Game.LocalPlayer.Character.CurrentVehicle != null) { if (cam.IsValid()) { if (cam.Active) { cam.Delete(); if (((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle).CheckIfEmergencyVehicle()) { cam = new Camera(true); ((DashVehicle)Game.LocalPlayer.Character.CurrentVehicle).SetDashview(cam); cam.Rotation = Game.LocalPlayer.Character.CurrentVehicle.Rotation; cam.FOV = NativeFunction.CallByHash <float>(0x65019750A0324133); activVeh = (DashVehicle)Game.LocalPlayer.Character.CurrentVehicle; } } } } GameFiber.Yield(); } }