Advertisement
TheVideoVolcano

Basic Script - GTAV - ScripthookDotNet

Apr 27th, 2015
789
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 3.29 KB | None | 0 0
  1. Imports System
  2. Imports GTA
  3. Imports System.Windows.Forms
  4. Imports System.Drawing
  5. Imports GTA.Math
  6. Imports System.Runtime.InteropServices
  7. Imports System.Text
  8.  
  9. Public Class BaseScriptV
  10.  
  11. Inherits Script
  12.  
  13.  Public Shared player As Player = Game.Player
  14.  Public Shared IniFile As String = ".\scripts\MY_INI_FILE.ini"
  15.  
  16.     Public Sub New()
  17.  
  18.         AddHandler Tick, AddressOf OnTick
  19.  
  20.         AddHandler KeyUp, AddressOf OnKeyUp
  21.  
  22.         AddHandler KeyDown, AddressOf OnKeyDown
  23.  
  24.  
  25.         Interval = 10
  26.     End Sub
  27.  
  28.  
  29.     Private Sub OnTick(ByVal sender As Object, ByVal e As EventArgs)
  30.  
  31.     End Sub
  32.  
  33.     Private Sub OnKeyUp(ByVal sender As Object, ByVal e As KeyEventArgs)
  34.  
  35.     End Sub
  36.  
  37.     Private Sub OnKeyDown(ByVal sender As Object, ByVal e As KeyEventArgs)
  38.  
  39.         Select e.KeyCode
  40.  
  41.     Case Keys.F6
  42.     'DO SOMETHING
  43.     Exit Select
  44.     End Select
  45.  
  46.  
  47.     End Sub
  48.  
  49. Private Function Rand(min As Int32, max As Int32)
  50.         Return New Random().Next(min, max)
  51.     End Function
  52.  
  53.     Private Shared Function GetTickCount() As Integer
  54.         Return Environment.TickCount()
  55.     End Function
  56.  
  57.     Public Shared Sub msg(ByVal text As String, Optional ByVal time As Integer = 2500)
  58.         GTA.Native.Function.Call(Native.Hash._SET_TEXT_ENTRY_2, "STRING")
  59.         GTA.Native.Function.Call(Native.Hash._ADD_TEXT_COMPONENT_STRING, text)
  60.         GTA.Native.Function.Call(Native.Hash._0x9D77056A530643F6, time, 1)
  61.     End Sub
  62.  
  63.     Private Function Exists(ByVal mEntity As Entity) As Boolean
  64.         If Not Native.Function.Call(Of Boolean)(Native.Hash.DOES_ENTITY_EXIST, mEntity) _
  65.             OrElse Not mEntity <> Nothing Then Return False
  66.         Return True
  67.     End Function
  68.  
  69.     Private Sub SetEntityProofs(mEnt As Entity, bullProof As Boolean, fireProof As Boolean, expProof As Boolean, collisProof As Boolean, meleeProof As Boolean, unk1 As Boolean, unk2 As Boolean, drownProof As Boolean)
  70.         Native.Function.Call(Native.Hash.SET_ENTITY_PROOFS, mEnt, bullProof, fireProof, expProof, collisProof, meleeProof, unk1, unk2, drownProof)
  71.     End Sub
  72.  
  73. Private Class TIni
  74.  
  75.     <DllImport("kernel32.dll", SetLastError:=True)> _
  76.     Private Shared Function GetPrivateProfileString(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpDefault As String, ByVal lpReturnedString As StringBuilder, ByVal nSize As Integer, ByVal lpFileName As String) As Integer
  77.     End Function
  78.  
  79.     <DllImport("kernel32.dll", SetLastError:=True)> _
  80.     Private Shared Function WritePrivateProfileString(ByVal lpAppName As String, ByVal lpKeyName As String, ByVal lpString As String, ByVal lpFileName As String) As Boolean
  81.     End Function
  82.  
  83.     Public Shared Function ReadINI(ByVal File As String, ByVal Section As String, ByVal Key As String, ByVal DefaultValue As String) As String
  84.  
  85.         Dim sb As New StringBuilder(500)
  86.  
  87.         GetPrivateProfileString(Section, Key, "", sb, sb.Capacity, File)
  88.         If sb.ToString = "" Then WriteINI(File, Section, Key, DefaultValue)
  89.         GetPrivateProfileString(Section, Key, "", sb, sb.Capacity, File)
  90.  
  91.         Return sb.ToString
  92.     End Function
  93.  
  94.     Public Shared Sub WriteINI(ByVal File As String, ByVal Section As String, ByVal Key As String, ByVal Value As String)
  95.  
  96.         WritePrivateProfileString(Section, Key, Value, File)
  97.  
  98.     End Sub
  99.  
  100. End Class
  101. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement