Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA; // This is a reference that is needed! do not edit this
- using GTA.Native; // This is a reference that is needed! do not edit this
- using GTA.Math;
- using System; // This is a reference that is needed! do not edit this
- using System.Windows.Forms; // This is a reference that is needed! do not edit this
- namespace NeverAutoCenterCamera
- {
- public class NeverAutoCenterCamera : Script // declare Modname as a script
- {
- bool ModEnabled = true;
- int SendInputTimer;
- static int WaitTimer = 100;
- bool SlightLeft;
- public NeverAutoCenterCamera() // main function
- {
- Tick += OnTick;
- KeyDown += OnKeyDown;
- KeyUp += OnKeyUp;
- Interval = 0;
- }
- void OnTick(object sender, EventArgs e) // This is where most of your script goes
- {
- if (ModEnabled)
- {
- if (!IsMouseMoving() && !Game.IsPaused)
- {
- if (SendInputTimer < Game.GameTime)
- {
- if (SlightLeft)
- {
- MoveCamSlightly(true);
- SendInputTimer = Game.GameTime + WaitTimer;
- SlightLeft = false;
- }
- else
- {
- MoveCamSlightly(false);
- SendInputTimer = Game.GameTime + WaitTimer;
- SlightLeft = true;
- }
- }
- }
- }
- }
- bool IsMouseMoving()
- {
- if (Game.GetControlNormal(2, GTA.Control.LookUpDown) == 0 && Game.GetControlNormal(2, GTA.Control.LookLeftRight) == 0)
- {
- return false;
- }
- return true;
- }
- bool IsKeyboard()
- {
- return Game.CurrentInputMode == InputMode.MouseAndKeyboard;
- }
- void MoveCamSlightly(bool left)
- {
- if (IsKeyboard())
- {
- float input = (left ? 0.2501f : -0.2501f);
- Game.SetControlNormal(2, GTA.Control.LookLeftRight, input);
- }
- }
- void OnKeyDown(object sender, KeyEventArgs e)
- {
- }
- void OnKeyUp(object sender, KeyEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement