Advertisement
julioCCs

Kidding with Animations - GTA iV

Jun 5th, 2013
1,545
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.66 KB | None | 0 0
  1. 'http://gtaxscripting.blogspot.com/
  2. 'http://www.facebook.com/GtaIVScripting
  3. 'https://www.youtube.com/user/GTAScripting
  4.  
  5. 'tutorial related to this code:
  6. 'http://gtaxscripting.blogspot.com.br/2013/06/tut-animations.html
  7.  
  8. Imports System
  9. Imports System.Drawing
  10. Imports System.Windows.Forms
  11. Imports GTA
  12. Imports System.IO
  13. Imports System.Text
  14.  
  15. Public Class BaseScriptProject
  16.     Inherits Script
  17.  
  18.     Private AnimSet As AnimationSet
  19.     Private AnimName As String = "run"
  20.  
  21.     Public Sub New()
  22.         Me.Interval = 10
  23.  
  24.         AnimSet = New AnimationSet("swimming")
  25.  
  26.         Native.Function.Call("REQUEST_ANIMS", "swimming")
  27.         Native.Function.Call("REQUEST_ANIMS", "move_rpg")
  28.     End Sub
  29.  
  30.     Private Sub msg(ByVal smsg As String, ByVal duracao As Int32)
  31.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", smsg, duracao, 1)
  32.     End Sub
  33.  
  34.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  35.         If e.Key = Keys.NumPad0 Then
  36.             Player.Character.Animation.Play(AnimSet, AnimName, 8)
  37.             msg("anim with no flags", 3000)
  38.         End If
  39.         If e.Key = Keys.NumPad1 Then
  40.             Player.Character.Animation.Play(AnimSet, AnimName, 8, AnimationFlags.Unknown01)
  41.             msg("anim with flags Unknown01 - Don't come back to initial position", 3000)
  42.         End If
  43.         If e.Key = Keys.NumPad2 Then
  44.             Player.Character.Animation.Play(AnimSet, AnimName, 8, AnimationFlags.Unknown01 Or AnimationFlags.Unknown05)
  45.             msg("anim with flags Unknown01 and Unknown05 - Unknown01 and loop animation", 3000)
  46.         End If
  47.         If e.Key = Keys.NumPad3 Then
  48.             Player.Character.Animation.Play(AnimSet, AnimName, 8, AnimationFlags.Unknown01 Or AnimationFlags.Unknown05 Or AnimationFlags.Unknown10)
  49.             msg("anim with flags Unknown01 and Unknown05 - Unknown01, Unknown05 and remove animation sounds", 3000)
  50.         End If
  51.  
  52.         If e.Key = Keys.NumPad4 Then
  53.             Dim p1_Repeat, p2, p3, p4_Stop_On_last_frame As Boolean
  54.             Dim timeOfPlayback As Int16 = 0
  55.  
  56.             p1_Repeat = False
  57.             p2 = False
  58.             p3 = False
  59.             p4_Stop_On_last_frame = True
  60.  
  61.             Native.Function.Call("TASK_PLAY_ANIM_SECONDARY_UPPER_BODY", Player.Character, "idle", "swimming", 8.0, _
  62.                 p1_Repeat, p2, p3, p4_Stop_On_last_frame, timeOfPlayback)
  63.         End If
  64.  
  65.         If e.Key = Keys.NumPad5 Then
  66.             Native.Function.Call("TASK_PLAY_ANIM_SECONDARY_IN_CAR", Player.Character, "idle", "swimming", 8.0, 0, 0, 0, 0, 0)
  67.         End If
  68.  
  69.         If e.Key = Keys.Back Then
  70.             Player.Character.Task.ClearAllImmediately()
  71.         End If
  72.  
  73.         If e.Key = Keys.Add Then
  74.             msg("move as move_rpg", 2000)
  75.             Native.Function.Call("SET_ANIM_GROUP_FOR_CHAR", Player.Character, "move_rpg")
  76.         End If
  77.  
  78.         If e.Key = Keys.Subtract Then
  79.             msg("move as move_player", 2000)
  80.             Native.Function.Call("SET_ANIM_GROUP_FOR_CHAR", Player.Character, "move_player")
  81.         End If
  82.     End Sub
  83.  
  84.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  85.     End Sub
  86.  
  87.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  88.         If Player.Character.Animation.isPlaying(AnimSet, AnimName) Then
  89.             msg(Player.Character.Animation.GetCurrentAnimationTime(AnimSet, AnimName).ToString, 150)
  90.         End If
  91.  
  92.         If Player.Character.Animation.isPlaying(AnimSet, "idle") Then
  93.             Dim tmpTime As Native.Pointer = New Native.Pointer(GetType(Single))
  94.  
  95.             Native.Function.Call("GET_CHAR_ANIM_CURRENT_TIME", Player.Character, "swimming", "idle", tmpTime)
  96.  
  97.             msg("playing idle animation of swimming category   Anim Time: " & _
  98.                 tmpTime.ToString, 1000)
  99.         End If
  100.  
  101.         If Game.isGameKeyPressed(GameKey.Sprint) Then
  102.             Native.Function.Call("SET_CHAR_ALL_ANIMS_SPEED", Player.Character, 1.5)
  103.         End If
  104.  
  105.         If Game.isKeyPressed(Keys.MButton) Then
  106.             Native.Function.Call("SET_CHAR_ANIM_SPEED", Player.Character, "swimming", "idle", 5.0)
  107.         End If
  108.  
  109.         If Game.isKeyPressed(Keys.NumPad9) Then
  110.             Native.Function.Call("SET_CHAR_ANIM_CURRENT_TIME", Player.Character, "swimming", "idle", 0.1)
  111.         End If
  112.     End Sub
  113.  
  114.     Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  115.     End Sub
  116.  
  117.     Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  118.     End Sub
  119. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement