Advertisement
Guest User

AutoTurnSignals

a guest
Apr 14th, 2017
142
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.58 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Windows.Forms;
  4. using GTA;
  5. using GTA.Native;
  6. using GTA.Math;
  7. using Font = GTA.Font;
  8. using System.Linq;
  9.  
  10. public class AutoTurnSignals : Script
  11.  
  12. {public AutoTurnSignals()
  13.  {Tick += OnTick;}
  14.  
  15.  public void OnTick(object o, EventArgs e)
  16.  {unsafe
  17.   {int direction = 0;
  18.    float poop = 0;
  19.    float distance = 0;
  20.  
  21.    if (Game.Player.Character.CurrentVehicle != null)
  22.    {if (Game.IsWaypointActive)
  23.     {var blip = World.GetActiveBlips().FirstOrDefault(b => b.Type == 4 && b.Sprite == BlipSprite.Waypoint);
  24.      Function.Call(Hash.GENERATE_DIRECTIONS_TO_COORD, blip.Position.X, blip.Position.Y, blip.Position.Z, 0, &direction, &poop, &distance);
  25.  
  26.      //UI.ShowSubtitle(direction.ToString());
  27.  
  28.      if ((direction == 3 || direction == 6) && (distance < 50))
  29.      {Game.Player.Character.CurrentVehicle.LeftIndicatorLightOn = true;
  30.       Game.Player.Character.CurrentVehicle.RightIndicatorLightOn = false;}
  31.  
  32.      if ((direction == 4 || direction == 7) && (distance < 50))
  33.      {Game.Player.Character.CurrentVehicle.LeftIndicatorLightOn = false;
  34.       Game.Player.Character.CurrentVehicle.RightIndicatorLightOn = true;}
  35.  
  36.      if ((direction != 3 && direction != 4 && direction != 6 && direction != 7) || (distance > 50))
  37.      {Game.Player.Character.CurrentVehicle.LeftIndicatorLightOn = false;
  38.       Game.Player.Character.CurrentVehicle.RightIndicatorLightOn = false;}}
  39.  
  40.     else
  41.     {Game.Player.Character.CurrentVehicle.LeftIndicatorLightOn = false;
  42.      Game.Player.Character.CurrentVehicle.RightIndicatorLightOn = false;}}}}}
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement