Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Imports System ' basic imports
- Imports GTA ' basic imports
- Imports System.Windows.Forms ' needed to have access to "keys" enumeration, for example
- Imports System.Drawing ' needed to handle colors referencing the color name, ex: myCar.color = System.Drawing.Color.Black
- Public Class BasicScript
- Inherits Script
- private l as light
- Public Sub New()
- Me.interval = 10
- l = new light
- l.enabled = true
- l.range = 0.5
- l.color = system.drawing.color.green
- End Sub
- private sub msg(sMsg as string, time as int32)
- Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
- end sub
- Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
- HLtargetedBodyPart
- end sub
- private sub HLtargetedBodyPart
- dim vec as vector3 = player.character.getboneposition(bone.head)
- dim minDist as double = 5
- dim fbone as bone
- dim pos as vector3
- while vec.distanceto(player.character.position) < 10
- for each p as ped in world.getpeds(vec, 1.0)
- if exists(p) andalso (p <> player.character) then
- if p.getboneposition(bone.head).distanceto(vec) < minDist then
- fbone = bone.head
- minDist = p.getboneposition(bone.head).distanceto(vec)
- pos = p.getboneposition(bone.head)
- end if
- if p.getboneposition(bone.RightForearm).distanceto(vec) < minDist then
- fbone = bone.RightForearm
- minDist = p.getboneposition(bone.RightForearm).distanceto(vec)
- pos = p.getboneposition(bone.RightForearm)
- end if
- if p.getboneposition(bone.LeftForearm).distanceto(vec) < minDist then
- fbone = bone.LeftForearm
- minDist = p.getboneposition(bone.LeftForearm).distanceto(vec)
- pos = p.getboneposition(bone.LeftForearm)
- end if
- if p.getboneposition(bone.RightFoot).distanceto(vec) < minDist then
- fbone = bone.RightFoot
- minDist = p.getboneposition(bone.RightFoot).distanceto(vec)
- pos = p.getboneposition(bone.RightFoot)
- end if
- if p.getboneposition(bone.LeftFoot).distanceto(vec) < minDist then
- fbone = bone.LeftFoot
- minDist = p.getboneposition(bone.LeftFoot).distanceto(vec)
- pos = p.getboneposition(bone.LeftFoot)
- end if
- if p.getboneposition(bone.RightHand).distanceto(vec) < minDist then
- fbone = bone.RightHand
- minDist = p.getboneposition(bone.RightHand).distanceto(vec)
- pos = p.getboneposition(bone.RightHand)
- end if
- if p.getboneposition(bone.LeftHand).distanceto(vec) < minDist then
- fbone = bone.LeftHand
- minDist = p.getboneposition(bone.LeftHand).distanceto(vec)
- pos = p.getboneposition(bone.LeftHand)
- end if
- if p.getboneposition(bone.spine).distanceto(vec) < minDist then
- fbone = bone.spine
- minDist = p.getboneposition(bone.spine).distanceto(vec)
- pos = p.getboneposition(bone.spine)
- end if
- if p.getboneposition(bone.RightCalf).distanceto(vec) < minDist then
- fbone = bone.RightCalf
- minDist = p.getboneposition(bone.RightCalf).distanceto(vec)
- pos = p.getboneposition(bone.RightCalf)
- end if
- if p.getboneposition(bone.LeftCalf).distanceto(vec) < minDist then
- fbone = bone.LeftCalf
- minDist = p.getboneposition(bone.LeftCalf).distanceto(vec)
- pos = p.getboneposition(bone.LeftCalf)
- end if
- l.position = pos - game.currentcamera.direction / 4
- msg(fbone.tostring, 1000)
- exit sub
- end if
- next
- vec += rotatevec(game.currentcamera.direction / 2, -5)
- end while
- end sub
- function rotateVec(vec as vector3, angle as double)
- angle = angle * (3.1415 / 180)
- dim s as double = system.math.sin(angle)
- dim c as double = system.math.cos(angle)
- vec.x = vec.x * c - vec.y * s
- vec.y = vec.x * s + vec.y * c
- return vec
- end function
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement