public void SetDashview(Camera cam) { for (int i = 0; i < Configs.confVehs.Length; i++) { uint vehHash = this.Model.Hash; if (vehHash == DashHelper.StringToHash(Configs.confVehs[i].ToLower())) { String[] offs = Configs.confOffset[i].Split(','); NativeFunction.CallByName <uint>("ATTACH_CAM_TO_ENTITY", cam, this, float.Parse(offs[0]), float.Parse(offs[1]), float.Parse(offs[2]), 1); break; } else { if (i == Configs.confVehs.Length - 1) { NativeFunction.CallByName <uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 1.3f, 1f, 1); } } } //String name = this.Model.Name.ToLower(); /*if (name == "sheriff2" || name == "fbi2" || name == "lguard" || name == "pranger") * { * NativeFunction.CallByName<uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 1.3f, 1f, 1); * } * else if (name == "ambulance" || name == "policet") * { * NativeFunction.CallByName<uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 1.5f, 1.3f, 1); * } * else if (name == "policeold1") * { * NativeFunction.CallByName<uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 0.8f, 1f, 1); * } * else if (name == "firetruk") * { * NativeFunction.CallByName<uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 4f, 0.8f, 1); * } * else if (name == "riot") * { * NativeFunction.CallByName<uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 1.7f, 1.6f, 1); * } * else * { * NativeFunction.CallByName<uint>("ATTACH_CAM_TO_ENTITY", cam, this, 0f, 0.75f, 0.65f, 1); * }*/ }
public static void SetLayout(int layout) // 0 - regular layout, 1 - sniper296 layout { if (DashHelper.eventOn && DashHelper.isDashOn) { if (DashHelper.layout == 1) { Game.FrameRender -= DashHelper.OnFrameRenderLayout2; } else { Game.FrameRender -= DashHelper.OnFrameRenderLayout1; } DashHelper.eventOn = false; } if (layout == 0) { DashHelper.layout = 0; Game.Console.Print("[DASHCAM V] Set to use regular layout."); } else if (layout == 1) { DashHelper.layout = 1; Game.Console.Print("[DASHCAM V] Set to use Sniper296's IVDashCam layout."); } else { Game.Console.Print("[DASHCAM V] Invalid input."); Game.Console.Print("[DASHCAM V] 0 for regular layout, 1 for IVDashCam layout."); } if (DashHelper.layout == 1 && !DashHelper.eventOn && DashHelper.isDashOn) { DashHelper.InitializeDashcam(1); DashHelper.eventOn = true; } else if (!DashHelper.eventOn && DashHelper.isDashOn) { DashHelper.InitializeDashcam(0); DashHelper.eventOn = true; } }
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(); } }