Advertisement
julioCCs

CoolTargetHUD.vb

Apr 8th, 2013
898
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.38 KB | None | 0 0
  1. 'https://www.youtube.com/user/GTAScripting
  2. 'http://gtaxscripting.blogspot.com/
  3. 'http://www.facebook.com/GtaIVScripting
  4. 'https://twitter.com/julionib
  5.  
  6. Imports System
  7. Imports GTA
  8. Imports System.Drawing
  9. Imports System.Windows.Forms
  10.  
  11. Public Class ScriptDevelopment
  12.     Inherits Script
  13.  
  14.     Private vehTargets As Vehicle()
  15.     Private timeWaitSearchTargets As Double = 0
  16.     Private targetAux As GTA.Object = Nothing
  17.     Private targetAuxRoll As Double = 0
  18.     Private actualTarget As Vehicle = Nothing
  19.  
  20.     Public Sub New()
  21.         Me.Interval = 10
  22.  
  23.         Wait(500)
  24.         targetAux = World.CreateObject("cj_dart_1", Vector3.Zero)
  25.         targetAux.FreezePosition = True
  26.         targetAux.Collision = False
  27.         targetAux.Visible = False
  28.     End Sub
  29.  
  30.     Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  31.        
  32.     End Sub
  33.  
  34.     Shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  35.     End Sub
  36.  
  37.     Private Sub general_tick(ByVal sender As Object, ByVal ev As EventArgs) Handles MyBase.Tick
  38.         If timeWaitSearchTargets <= 0 Then
  39.             timeWaitSearchTargets = 300
  40.  
  41.             vehTargets = World.GetAllVehicles
  42.         Else
  43.             timeWaitSearchTargets -= Me.Interval
  44.         End If
  45.  
  46.         actualTarget = Nothing
  47.  
  48.         If Game.isGameKeyPressed(GameKey.Aim) AndAlso Exists(vehTargets) Then
  49.             Dim tmpDist As Double
  50.             Dim tmpPosCompare As Vector3
  51.  
  52.             For Each v As Vehicle In vehTargets
  53.                 If Exists(v) AndAlso (v <> Player.Character.CurrentVehicle) Then
  54.                     tmpDist = v.Position.DistanceTo(Game.CurrentCamera.Position)
  55.                     tmpPosCompare = Game.CurrentCamera.Position + Game.CurrentCamera.Direction * tmpDist
  56.  
  57.                     If v.Position.DistanceTo(tmpPosCompare) < 1.5 Then
  58.                         actualTarget = v
  59.  
  60.                         Exit For
  61.                     End If
  62.                 End If
  63.             Next
  64.         End If
  65.  
  66.         If Exists(actualTarget) Then
  67.             Dim tmpTargetPos As Vector3
  68.             Dim tmpDistCoef As Double
  69.             Dim tmpDiameter As Double = 1.5
  70.             Dim tmpRotation As Vector3
  71.  
  72.             targetAuxRoll += 5
  73.  
  74.             If targetAuxRoll > 360 Then targetAuxRoll = 0
  75.  
  76.             'targetAux.Position = Game.CurrentCamera.Position
  77.             targetAux.Position = Player.Character.Position
  78.             tmpRotation = Game.CurrentCamera.Rotation
  79.             tmpRotation.Y = targetAuxRoll
  80.             targetAux.Rotation = tmpRotation
  81.  
  82.             tmpDistCoef = actualTarget.Position.DistanceTo(targetAux.Position) / 100
  83.  
  84.             tmpTargetPos = actualTarget.Position + (targetAux.Position - targetAux.GetOffsetPosition(Vector3.RelativeTop * tmpDiameter))
  85.             Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  86.  
  87.             tmpTargetPos = actualTarget.Position + (targetAux.Position - targetAux.GetOffsetPosition(Vector3.RelativeBottom * tmpDiameter))
  88.             Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  89.  
  90.             tmpTargetPos = actualTarget.Position + (targetAux.Position - targetAux.GetOffsetPosition(Vector3.RelativeRight * tmpDiameter))
  91.             Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  92.  
  93.             tmpTargetPos = actualTarget.Position + (targetAux.Position - targetAux.GetOffsetPosition(Vector3.RelativeLeft * tmpDiameter))
  94.             Native.Function.Call("DRAW_CHECKPOINT", tmpTargetPos.X, tmpTargetPos.Y, tmpTargetPos.Z, 1 * tmpDistCoef, 255, 0, 0)
  95.  
  96.             actualTarget.ApplyForce(Vector3.WorldUp * 0.5)
  97.         End If
  98.     End Sub
  99.  
  100.     Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  101.     End Sub
  102.  
  103.     Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  104.        
  105.     End Sub
  106.  
  107.     Private Sub msg(ByVal sMsg As String, ByVal time As Int32)
  108.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  109.     End Sub
  110.  
  111.     Private Function intervalFix() As Double
  112.         Return Me.Interval * (Game.FPS / 25)
  113.     End Function
  114. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement