Advertisement
julioCCs

HighLightBodyPart.vb

Dec 19th, 2012
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.85 KB | None | 0 0
  1. Imports System ' basic imports
  2. Imports GTA ' basic imports
  3. Imports System.Windows.Forms ' needed to have access to "keys" enumeration, for example
  4. Imports System.Drawing ' needed to handle colors referencing the color name, ex: myCar.color = System.Drawing.Color.Black
  5.  
  6. Public Class BasicScript
  7.     Inherits Script
  8.    
  9.     private l as light
  10.        
  11.     Public Sub New()
  12.         Me.interval = 10
  13.        
  14.         l = new light
  15.         l.enabled = true
  16.         l.range = 0.5
  17.         l.color = system.drawing.color.green
  18.     End Sub
  19.    
  20.     private sub msg(sMsg as string, time as int32)
  21.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  22.     end sub
  23.    
  24.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick     
  25.         HLtargetedBodyPart
  26.     end sub
  27.    
  28.     private sub HLtargetedBodyPart
  29.         dim vec as vector3 = player.character.getboneposition(bone.head)
  30.         dim minDist as double = 5
  31.         dim fbone as bone
  32.         dim pos as vector3
  33.        
  34.         while vec.distanceto(player.character.position) < 10
  35.             for each p as ped in world.getpeds(vec, 1.0)
  36.                 if exists(p) andalso (p <> player.character) then
  37.                     if p.getboneposition(bone.head).distanceto(vec) < minDist then
  38.                         fbone = bone.head
  39.                         minDist = p.getboneposition(bone.head).distanceto(vec)
  40.                         pos = p.getboneposition(bone.head)
  41.                     end if
  42.                     if p.getboneposition(bone.RightForearm).distanceto(vec) < minDist then
  43.                         fbone = bone.RightForearm
  44.                         minDist = p.getboneposition(bone.RightForearm).distanceto(vec)
  45.                         pos = p.getboneposition(bone.RightForearm)
  46.                     end if
  47.                     if p.getboneposition(bone.LeftForearm).distanceto(vec) < minDist then
  48.                         fbone = bone.LeftForearm
  49.                         minDist = p.getboneposition(bone.LeftForearm).distanceto(vec)
  50.                         pos = p.getboneposition(bone.LeftForearm)
  51.                     end if
  52.                     if p.getboneposition(bone.RightFoot).distanceto(vec) < minDist then
  53.                         fbone = bone.RightFoot
  54.                         minDist = p.getboneposition(bone.RightFoot).distanceto(vec)
  55.                         pos = p.getboneposition(bone.RightFoot)
  56.                     end if
  57.                     if p.getboneposition(bone.LeftFoot).distanceto(vec) < minDist then
  58.                         fbone = bone.LeftFoot
  59.                         minDist = p.getboneposition(bone.LeftFoot).distanceto(vec)
  60.                         pos = p.getboneposition(bone.LeftFoot)
  61.                     end if
  62.                     if p.getboneposition(bone.RightHand).distanceto(vec) < minDist then
  63.                         fbone = bone.RightHand
  64.                         minDist = p.getboneposition(bone.RightHand).distanceto(vec)
  65.                         pos = p.getboneposition(bone.RightHand)
  66.                     end if
  67.                     if p.getboneposition(bone.LeftHand).distanceto(vec) < minDist then
  68.                         fbone = bone.LeftHand
  69.                         minDist = p.getboneposition(bone.LeftHand).distanceto(vec)
  70.                         pos = p.getboneposition(bone.LeftHand)
  71.                     end if
  72.                     if p.getboneposition(bone.spine).distanceto(vec) < minDist then
  73.                         fbone = bone.spine
  74.                         minDist = p.getboneposition(bone.spine).distanceto(vec)
  75.                         pos = p.getboneposition(bone.spine)
  76.                     end if
  77.                     if p.getboneposition(bone.RightCalf).distanceto(vec) < minDist then
  78.                         fbone = bone.RightCalf
  79.                         minDist = p.getboneposition(bone.RightCalf).distanceto(vec)
  80.                         pos = p.getboneposition(bone.RightCalf)
  81.                     end if
  82.                     if p.getboneposition(bone.LeftCalf).distanceto(vec) < minDist then
  83.                         fbone = bone.LeftCalf
  84.                         minDist = p.getboneposition(bone.LeftCalf).distanceto(vec)
  85.                         pos = p.getboneposition(bone.LeftCalf)
  86.                     end if
  87.                    
  88.                     l.position = pos - game.currentcamera.direction / 4
  89.                    
  90.                     msg(fbone.tostring, 1000)
  91.                    
  92.                     exit sub
  93.                 end if
  94.             next
  95.            
  96.             vec += rotatevec(game.currentcamera.direction / 2, -5)
  97.         end while
  98.     end sub
  99.    
  100.     function rotateVec(vec as vector3, angle as double)
  101.         angle = angle * (3.1415 / 180)
  102.        
  103.         dim s as double = system.math.sin(angle)
  104.         dim c as double = system.math.cos(angle)
  105.        
  106.         vec.x = vec.x * c - vec.y * s
  107.         vec.y = vec.x * s + vec.y * c
  108.        
  109.         return vec
  110.     end function
  111. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement