Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using GTA;
- using GTA.Math;
- using GTA.Native;
- using System;
- using System.IO;
- using System.Windows.Forms;
- public class AutoBlinkers : Script
- {
- string ScriptName = "AutoBlinkers";
- string ScriptVer = "1.0";
- int reftime = Game.GameTime;
- int interval = 3000;
- public AutoBlinkers()
- {
- Tick += OnTick;
- }
- void OnTick(object sender, EventArgs e)
- {
- Vehicle veh = Game.Player.Character.CurrentVehicle;
- if (CanWeUse(veh))
- {
- float angle = (float)Math.Round(veh.SteeringAngle,0);
- Vector3 pos = veh.Position;
- if (Function.Call<bool>(Hash.IS_POINT_ON_ROAD, pos.X, pos.Y, pos.Z, veh) && angle != 0 && veh.Speed>-1 && veh.Speed<10)
- {
- reftime = Game.GameTime;
- if (angle > 0)
- {
- veh.RightIndicatorLightOn = false;
- veh.LeftIndicatorLightOn = true;
- }
- else
- {
- veh.RightIndicatorLightOn = true;
- veh.LeftIndicatorLightOn = false;
- }
- }
- if (Game.GameTime > reftime + interval)
- {
- reftime = Game.GameTime;
- veh.LeftIndicatorLightOn = false;
- veh.RightIndicatorLightOn = false;
- }
- }
- else
- {
- veh = Game.Player.LastVehicle;
- if (CanWeUse(veh))
- {
- Vector3 pos = veh.Position;
- if (Function.Call<bool>(Hash.IS_POINT_ON_ROAD, pos.X, pos.Y, pos.Z, veh))
- {
- veh.RightIndicatorLightOn = true;
- veh.LeftIndicatorLightOn = true;
- }
- }
- }
- }
- bool CanWeUse(Entity entity)
- {
- return entity != null && entity.Exists();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement