Advertisement
TheVideoVolcano

GTA V Complete Checkpoint Class VB.NET

Jul 11th, 2015
1,003
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 5.97 KB | None | 0 0
  1. 'By THEVIDEOVOLCANO/RGSOFTWARE
  2.  
  3. Imports GTA, GTA.Math
  4. Imports System.Drawing
  5.  
  6. Public Class TCheckpoint
  7.  
  8.     Private checkp As Int32 = 0
  9.     Private g_pos As Vector3 = Vector3.Zero
  10.     Private g_height As Vector3 = New Vector3(2.5, 2.5, 2.5)
  11.     Private g_checkType As Int32 = 0
  12.     Private g_radius As Single = 0
  13.     Private g_red As Int32 = 0
  14.     Private g_green As Int32 = 0
  15.     Private g_blue As Int32 = 0
  16.     Private g_alpha As Int32 = 0
  17.     Private g_unknown As Int32 = 0
  18.     Private g_alignwithgnd As Boolean = False
  19.  
  20.     Public Overloads Sub Create(ByVal checkType As TCheckpoint.CheckType, ByVal position As Vector3, ByVal radius As Single, ByVal red As Int32, ByVal green As Int32, ByVal blue As Int32, ByVal alpha As Int32, ByVal AlignWithGround As Boolean, Optional ByVal unknown As Int32 = 0)
  21.  
  22.         If Handle() <> 0 Then Delete()
  23.  
  24.         If AlignWithGround Then position = New Vector3(position.X, position.Y, position.Z - 1)
  25.  
  26.  
  27.         checkp = Native.Function.Call(Of Int32)(Native.Hash.CREATE_CHECKPOINT, checkType, position.X, position.Y, position.Z, position.X, position.Y, position.Z, radius, red, green, blue, alpha, unknown)
  28.  
  29.         g_checkType = checkType
  30.         g_pos = position
  31.         g_radius = radius
  32.         g_red = red
  33.         g_green = green
  34.         g_blue = blue
  35.         g_alpha = alpha
  36.         g_unknown = unknown
  37.         g_alignwithgnd = AlignWithGround
  38.  
  39.     End Sub
  40.  
  41.     Public Overloads Sub Create(ByVal checkType As TCheckpoint.CheckType, ByVal posX As Single, ByVal posY As Single, ByVal posZ As Single, ByVal radius As Single, ByVal red As Int32, ByVal green As Int32, ByVal blue As Int32, ByVal alpha As Int32, ByVal AlignWithGround As Boolean, Optional ByVal unknown As Int32 = 0)
  42.         Create(checkType, New Vector3(posX, posY, posZ), radius, red, green, blue, alpha, AlignWithGround, unknown)
  43.     End Sub
  44.  
  45.     Public Overloads Sub Create(ByVal checkType As TCheckpoint.CheckType, ByVal posX As Single, ByVal posY As Single, ByVal posZ As Single, ByVal radius As Single, ByVal color As Color, ByVal alpha As Int32, ByVal AlignWithGround As Boolean, Optional ByVal unknown As Int32 = 0)
  46.         Create(checkType, New Vector3(posX, posY, posZ), radius, color.R, color.G, color.B, alpha, AlignWithGround, unknown)
  47.     End Sub
  48.  
  49.     Public Overloads Sub Create(ByVal checkType As TCheckpoint.CheckType, ByVal position As Vector3, ByVal radius As Single, ByVal color As Color, ByVal alpha As Int32, ByVal AlignWithGround As Boolean, Optional ByVal unknown As Int32 = 0)
  50.         Create(checkType, position, radius, color.R, color.G, color.B, alpha, AlignWithGround, unknown)
  51.     End Sub
  52.  
  53.     Public Sub Delete()
  54.         Native.Function.Call(Native.Hash.DELETE_CHECKPOINT, Handle())
  55.         checkp = 0
  56.     End Sub
  57.  
  58.     Public Function isCylinder() As Boolean
  59.         Dim match As Int16() = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 20, 21, 22, 24, 28, 42, 45} 'Checkpoints, of type Cylinder
  60.         Return match.Contains(g_checkType)
  61.     End Function
  62.  
  63.     Public ReadOnly Property Exists() As Boolean
  64.         Get
  65.             Return checkp <> 0
  66.         End Get
  67.     End Property
  68.  
  69.     Public Enum CheckType
  70.         CylinderSingleArrow = 0
  71.         CylinderDoubleArrow = 1
  72.         CylinderTripleArrow = 2
  73.         CylinderCycleArrow = 3
  74.         CylinderChecker = 4
  75.         CyclinderFadeSingleArrow = 5
  76.         CyclinderFadeDoubleArrow = 6
  77.         CylinderFadeTripleArrow = 7
  78.         CyclinderFadeCycleArrow = 8
  79.         CylinderSmallLowChecker = 9
  80.         ArrowInCircle = 10
  81.         DoubleArrowInCircle = 11
  82.         TripleArrowInCircle = 12
  83.         CycleArrowInCircle = 13
  84.         CheckerInCircle = 14
  85.         Arrow = 15
  86.         DoubleArrow2 = 16
  87.         DoubleArrow3 = 17
  88.         CycleArrow2 = 18
  89.         CheckerFinish = 19
  90.         CylinderArrowLeft = 20
  91.         CylinderDoubleLeftArrow = 21
  92.         CylinderTripleLeftArrow = 22
  93.         CylinderHightChecker = 24
  94.         CylinderHighCycleArrow = 28
  95.         PlaneLeftRollInCircle = 36
  96.         PlaneRightRollInCircle = 36
  97.         PlaneForwardInCircle = 36
  98.         CircleBankLeft = 40
  99.         CylinderZero = 42
  100.         Cylinder = 45
  101.     End Enum
  102.  
  103.     Public ReadOnly Property Handle() As Int32
  104.         Get
  105.             Return checkp
  106.         End Get
  107.     End Property
  108.  
  109.     Private Sub setPos(ByVal newPos As Vector3)
  110.         If Exists() Then
  111.             Create(g_checkType, newPos, g_radius, g_red, g_green, g_blue, g_alpha, g_alignwithgnd, g_unknown)
  112.             Height(g_height.X, g_height.Y, g_height.Z)
  113.         End If
  114.     End Sub
  115.  
  116.     Public Property Position() As Vector3
  117.  
  118.         Get
  119.             Return g_pos
  120.         End Get
  121.         Set(value As Vector3)
  122.             setPos(value)
  123.         End Set
  124.  
  125.     End Property
  126.  
  127.     Private Sub setRadius(ByVal newRadius As Single)
  128.         If Exists() Then
  129.             Create(g_checkType, g_pos, newRadius, g_red, g_green, g_blue, g_alpha, g_alignwithgnd, g_unknown)
  130.             Height(g_height.X, g_height.Y, g_height.Z)
  131.         End If
  132.     End Sub
  133.  
  134.     Public Property Radius() As Single
  135.  
  136.         Get
  137.             Return g_radius
  138.         End Get
  139.         Set(value As Single)
  140.             setRadius(value)
  141.         End Set
  142.  
  143.     End Property
  144.  
  145.     Public Sub Height(ByVal X As Single, ByVal Y As Single, ByVal Z As Single)
  146.         If Exists() AndAlso isCylinder() Then
  147.             Native.Function.Call(Native.Hash.SET_CHECKPOINT_CYLINDER_HEIGHT, Handle(), X, Y, Z)
  148.             g_height = New Vector3(X, Y, Z)
  149.         End If
  150.     End Sub
  151.  
  152.     Public Overloads Sub Color(ByVal Red As Int32, ByVal Green As Int32, ByVal Blue As Int32, ByVal Alpha As Int32)
  153.         If Exists() Then
  154.             Native.Function.Call(Native.Hash.SET_CHECKPOINT_RGBA, Handle(), Red, Green, Blue, Alpha)
  155.             g_red = Red
  156.             g_green = Green
  157.             g_blue = Blue
  158.         End If
  159.     End Sub
  160.  
  161.     Public Overloads Sub Color(ByVal Colour As Color, Optional Alpha As Int32 = 255)
  162.         Color(Colour.R, Colour.G, Colour.B, Alpha)
  163.     End Sub
  164.  
  165. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement