Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 'http://gtaxscripting.blogspot.com/
- 'http://www.facebook.com/GtaIVScripting
- 'https://www.youtube.com/user/GTAScripting
- 'tutorial related to this code:
- 'http://gtaxscripting.blogspot.com.br/2013/06/tut-flight-ideas-for-peds.html
- Imports System
- Imports System.Drawing
- Imports System.Windows.Forms
- Imports GTA
- Imports System.IO
- Imports System.Text
- Public Class BaseScriptProject
- Inherits Script
- Private bFlightIdeaTwoOn As Boolean = False
- Private bFlightIdeaTwoHighSpeedOn As Boolean = False
- Private bFlightIdeaThree As Boolean = False
- Private force As Double = 1
- Private myFlyingVehicle As Vehicle = Nothing
- Private myFlyingObject As GTA.Object = Nothing
- Private animSetFlight As AnimationSet
- Public Sub New()
- Me.Interval = 10
- Wait(500)
- myFlyingVehicle = World.CreateVehicle("faggio", Player.Character.Position + Vector3.WorldUp * 100)
- myFlyingVehicle.Visible = False
- myFlyingVehicle.CanBeDamaged = False
- myFlyingVehicle.CanBeVisiblyDamaged = False
- myFlyingObject = World.CreateObject("cj_dumpster_1", Player.Character.Position + Vector3.WorldUp * 105)
- myFlyingObject.Visible = False
- animSetFlight = New AnimationSet("parachute")
- Native.Function.Call("request_anims", animSetFlight.Name)
- End Sub
- Private Sub msg(ByVal smsg As String, ByVal duracao As Int32)
- Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", smsg, duracao, 1)
- End Sub
- Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
- If (e.Key = Keys.NumPad2) OrElse (e.Key = Keys.NumPad3) Then
- Player.Character.Animation.Play(animSetFlight, "", 5.0) ' stops an possible flight animation
- If e.Key = Keys.NumPad3 Then
- bFlightIdeaTwoHighSpeedOn = Not bFlightIdeaTwoHighSpeedOn
- bFlightIdeaTwoOn = False
- bFlightIdeaThree = False
- Else
- bFlightIdeaTwoOn = Not bFlightIdeaTwoOn
- bFlightIdeaTwoHighSpeedOn = False
- bFlightIdeaThree = False
- End If
- If bFlightIdeaTwoOn OrElse bFlightIdeaTwoHighSpeedOn Then
- If bFlightIdeaTwoHighSpeedOn Then
- msg("Second flight idea ON (High speed)", 3000)
- Else
- msg("Second flight idea ON", 3000)
- End If
- myFlyingVehicle.Position = Player.Character.Position + Player.Character.Direction
- myFlyingVehicle.Rotation = Game.CurrentCamera.Rotation
- Player.Character.Task.ClearAllImmediately()
- Player.Character.Task.WarpIntoVehicle(myFlyingVehicle, VehicleSeat.Driver)
- Wait(1000)
- Else
- msg("Second flight idea OFF", 3000)
- Player.Character.Task.ClearAllImmediately()
- End If
- End If
- If e.Key = Keys.NumPad4 Then
- Player.Character.Animation.Play(animSetFlight, "", 5.0)
- bFlightIdeaThree = Not bFlightIdeaThree
- bFlightIdeaTwoOn = False
- bFlightIdeaTwoHighSpeedOn = False
- If bFlightIdeaThree Then
- msg("Third flight idea ON", 3000)
- myFlyingObject.Position = Player.Character.Position + Player.Character.Direction * 2
- Native.Function.Call("ATTACH_PED_TO_OBJECT", Player.Character, myFlyingObject, False, 0, -2.0, 0, 0, 0, False, False)
- Else
- msg("Third flight idea OFF", 3000)
- Native.Function.Call("detach_ped", Player.Character)
- 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 general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
- If Game.isKeyPressed(Keys.NumPad0) Then
- msg("force: " & force.ToString & " vel. vec.: " & Player.Character.Velocity.ToString & _
- " speed: " & Player.Character.Velocity.Length.ToString, 100)
- Player.Character.Velocity = Game.CurrentCamera.Direction * force
- force += 1
- ElseIf Game.isKeyPressed(Keys.NumPad1) Then
- msg("force: " & force.ToString & " vel. vec.: " & Player.Character.Velocity.ToString & _
- " speed: " & Player.Character.Velocity.Length.ToString, 100)
- Player.Character.Velocity = Vector3.Zero
- Player.Character.ApplyForce(Game.CurrentCamera.Direction * force)
- force += 1
- ElseIf bFlightIdeaTwoOn OrElse bFlightIdeaTwoHighSpeedOn Then
- If bFlightIdeaTwoHighSpeedOn Then
- msg("High speed - force: " & force.ToString & " speed: " & myFlyingVehicle.Speed.ToString, 100)
- Native.Function.Call("set_car_forward_speed", myFlyingVehicle, force)
- Else
- msg("force: " & force.ToString & " speed: " & myFlyingVehicle.Speed.ToString, 100)
- myFlyingVehicle.Speed = 0
- myFlyingVehicle.ApplyForce(Game.CurrentCamera.Direction * force)
- End If
- myFlyingVehicle.EngineRunning = False
- myFlyingVehicle.Rotation = Game.CurrentCamera.Rotation
- ElseIf bFlightIdeaThree Then
- Dim tmpSpeedVec As Vector3 = Game.CurrentCamera.Direction * force
- msg("force: " & force.ToString & " vel. vec.: " & myFlyingObject.Velocity.ToString & _
- " speed: " & myFlyingObject.Velocity.Length.ToString, 100)
- myFlyingObject.Rotation = Game.CurrentCamera.Rotation
- Native.Function.Call("SET_OBJECT_INITIAL_VELOCITY", myFlyingObject, tmpSpeedVec.X, tmpSpeedVec.Y, tmpSpeedVec.Z)
- Else
- force = 0
- End If
- If bFlightIdeaTwoOn OrElse bFlightIdeaTwoHighSpeedOn OrElse bFlightIdeaThree Then
- If Not Player.Character.Animation.isPlaying(animSetFlight, "full_brake_for_landing") Then _
- Player.Character.Animation.Play(animSetFlight, "full_brake_for_landing", 5.0, AnimationFlags.Unknown05)
- If Game.isGameKeyPressed(GameKey.MoveForward) Then
- If force < 200 Then force += 1
- Else
- If force > 0 Then
- force -= 0.5
- If force < 0 Then force = 0
- End If
- End If
- End If
- End Sub
- Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
- End Sub
- Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
- End Sub
- End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement