Advertisement
Guest User

Code Rewrite

a guest
Apr 23rd, 2019
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 3.05 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows.Forms;
  7. using GTA;
  8. using GTA.Native;
  9.  
  10. namespace TrackersV
  11. {
  12.     public class TrackersV : Script
  13.     {
  14.         List<Entity> entityList = new List<Entity>();
  15.         List<Entity> allEntityList = new List<Entity>();
  16.         List<Blip> blipList = new List<Blip>();
  17.         public TrackersV()
  18.         {
  19.             KeyDown += OnKeyDown;
  20.             Tick += TrackersV_Tick;
  21.         }
  22.  
  23.         private void addBlips()
  24.         {
  25.             foreach (Entity trackedEntity in allEntityList)
  26.             {
  27.                 BlipColor blipColor;
  28.                 if (Game.Player.Character.Model == PedHash.Michael)
  29.                 {
  30.                     blipColor = BlipColor.Michael;
  31.                 }
  32.                 else if (Game.Player.Character.Model == PedHash.Franklin)
  33.                 {
  34.                     blipColor = BlipColor.Franklin;
  35.                 }
  36.                 else if (Game.Player.Character.Model == PedHash.Trevor)
  37.                 {
  38.                     blipColor = BlipColor.Trevor;
  39.                 }
  40.                 else
  41.                 {
  42.                     blipColor = BlipColor.Freemode;
  43.                 }
  44.  
  45.                 List<GTA.Math.Vector3> blipPositions = new List<GTA.Math.Vector3>();
  46.                 foreach (Blip blip in World.GetActiveBlips())
  47.                 {
  48.                     blipPositions.Add(blip.Position);
  49.                 }
  50.                 if (trackedEntity.Exists() && !trackedEntity.CurrentBlip.Exists() && entityList.Contains(trackedEntity))
  51.                 {
  52.                     Blip newBlip = trackedEntity.AddBlip();
  53.                     newBlip.Color = blipColor;
  54.                     newBlip.Name = trackedEntity.Model.ToString();
  55.                     newBlip.IsShortRange = false;
  56.                     newBlip.IsFlashing = true;
  57.                     newBlip.ShowRoute = true;
  58.                     newBlip.Scale = 1;
  59.                    
  60.                 } else if (trackedEntity.CurrentBlip.Exists() && !entityList.Contains(trackedEntity))
  61.                 {
  62.                     trackedEntity.CurrentBlip.Remove();
  63.                 }
  64.                
  65.                
  66.             }
  67.         }
  68.  
  69.         private void TrackersV_Tick(object sender, EventArgs e)
  70.         {
  71.             addBlips();
  72.         }
  73.  
  74.         private void OnKeyDown(object source, KeyEventArgs e)
  75.         {
  76.             if (e.KeyCode == Keys.J)
  77.             {
  78.                 AddEntity();
  79.             }
  80.         }
  81.  
  82.         private void AddEntity()
  83.         {
  84.             Entity Target = Game.Player.GetTargetedEntity();
  85.             if (Target != null && Target.Exists())
  86.             {
  87.                 if (!entityList.Contains(Target))
  88.                 {
  89.                     entityList.Add(Target);
  90.                     allEntityList.Add(Target);
  91.                 } else
  92.                 {
  93.                     entityList.Remove(Target);
  94.                 }
  95.             }
  96.         }        
  97.     }
  98. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement