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
- Imports System.IO
- Public Class BasicScript
- Inherits Script
- private myCheckPoint as checkpoint
- Public Sub New()
- Me.interval = 10
- myCheckPoint = new CheckPoint
- myCheckPoint.color = System.Drawing.Color.red
- myCheckPoint.diameter = 1.0
- myCheckPoint.position = player.character.position
- myCheckPoint.visible = true
- 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 keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
- if e.key = keys.d1 then
- dim myPed as ped = targetedPed(50)
- if exists(myPed) then
- myPed.velocity = vector3.worldup * 15
- myPed.isragdoll = true
- end if
- end if
- if e.key = keys.d2 then
- dim myVeh as vehicle = targetedVeh(200)
- if exists(myVeh) then
- myVeh.applyforce(vector3.worldup * 15, vector3.worldup * 3)
- end if
- end if
- if e.key = keys.d3 then
- dim myObj as gta.object = targetedObj(50)
- if exists(myObj) then
- myObj.detach
- myObj.applyforce(vector3.worldup * 15, vector3.worldup * 3)
- end if
- end if
- if e.key = keys.d4 then
- dim myVec as vector3 = targetedGround(200)
- if myVec <> vector3.zero then
- player.character.position = myVec
- end if
- end if
- End Sub
- Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
- end sub
- private sub cmd(ByVal sender As Object, ByVal e As GTA.ConsoleEventArgs) Handles MyBase.ConsoleCommand
- end sub
- Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
- 'if exists(player.gettargetedped) then
- ' player.gettargetedped.velocity = vector3.worldup
- ' msg("found", 15)
- 'end if
- end sub
- public sub myGraph(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
- end sub
- private function targetedPed(maxDist as double)
- dim myVec as vector3 = player.character.position
- while myVec.distanceto(player.character.position) < maxDist
- myCheckPoint.position = myVec
- for each p as ped in world.getpeds(myVec, 1.0)
- if exists(p) andalso (p <> player.character) then return p
- next
- myVec += game.currentcamera.direction
- end while
- return nothing
- end function
- private function targetedVeh(maxDist as double)
- dim myVec as vector3 = player.character.position
- while myVec.distanceto(player.character.position) < maxDist
- myCheckPoint.position = myVec
- for each v as vehicle in world.getvehicles(myVec, 1.0)
- if exists(v) andalso (v <> player.character.currentvehicle) then return v
- next
- myVec += game.currentcamera.direction
- end while
- return nothing
- end function
- private function targetedObj(maxDist as double)
- dim myVec as vector3 = player.character.position
- dim myOList as gta.object() = world.getallobjects
- while myVec.distanceto(player.character.position) < maxDist
- myCheckPoint.position = myVec
- for each o as gta.object in myOList
- if exists(o) andalso (o.position.distanceto(myVec) <= 1.0) andalso (o.position.distanceto(player.character.position) > 2) then return o
- next
- myVec += game.currentcamera.direction
- end while
- return nothing
- end function
- private function targetedGround(maxDist as double)
- dim myVec as vector3 = player.character.position
- dim myVecRes as vector3
- while myVec.distanceto(player.character.position) < maxDist
- myCheckPoint.position = myVec
- myVecRes = world.GetGroundPosition(myVec, GroundType.Lowest)
- if myVecRes.distanceto(myVec) <= 1.0 then return myVecRes
- myVec += game.currentcamera.direction
- end while
- return vector3.zero
- end function
- 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