Advertisement
julioCCs

BasicScript7.vb

Nov 4th, 2012
227
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.67 KB | None | 0 0
  1. Imports System ' basic imports
  2. Imports GTA ' basic imports
  3. Imports System.Windows.Forms ' needed to have access to "keys" enumeration, for example
  4. Imports System.Drawing ' needed to handle colors referencing the color name, ex: myCar.color = System.Drawing.Color.Black
  5.  
  6. Public Class BasicScript
  7.     Inherits Script
  8.    
  9.     private myIntVar as int32
  10.     private myStringVar as string
  11.     private myHotKey as int32
  12.    
  13.     Public Sub New()
  14.         Me.interval = 10
  15.        
  16.         if Settings.GetValueInteger("myIntVar", "EXAMPLE1", -1) = -1 then Settings.SetValue("myIntVar", "EXAMPLE1", 0)
  17.         if Settings.GetValueString("myStringVar", "EXAMPLE1", "") = "" then Settings.SetValue("myStringVar", "EXAMPLE1", "myDefault")
  18.         if Settings.GetValueKey("myHotKey", "EXAMPLE2", -1) = -1 then Settings.SetValue("myHotKey", "EXAMPLE2", keys.O)
  19.        
  20.         Settings.save
  21.        
  22.         myIntVar = Settings.GetValueInteger("myIntVar", "EXAMPLE1", 0)
  23.         myStringVar = Settings.GetValueString("myStringVar", "EXAMPLE1", "default")
  24.         myHotKey = Settings.GetValueKey("myHotKey", "EXAMPLE2", keys.A)
  25.     End Sub
  26.    
  27.     private sub msg(sMsg as string, time as int32)
  28.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  29.     end sub
  30.    
  31.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  32.         if e.key = myHotKey then player.character.die
  33.        
  34.         Settings.SetValue("myKey" & e.key.tostring, "Keys", e.key)     
  35.         Settings.save
  36.     End Sub
  37.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  38.     end sub
  39.    
  40.     private sub cmd(ByVal sender As Object, ByVal e As GTA.ConsoleEventArgs) Handles MyBase.ConsoleCommand
  41.         if e.parametercount > 0 then
  42.             dim myStr as string = ""
  43.             dim myVec as vector3
  44.            
  45.             for c as int16 = 0 to e.parametercount - 1
  46.                 myStr &= " " & e.parameter(c)
  47.                
  48.                 if c = 0 then myVec.x = convert.toint32(e.parameter(c))
  49.                 if c = 1 then myVec.y = convert.toint32(e.parameter(c))
  50.                 if c = 2 then myVec.z = convert.toint32(e.parameter(c))
  51.             next
  52.            
  53.             msg(e.command & " params " & myStr, 20000)
  54.            
  55.             player.character.velocity = myVec
  56.         else
  57.             msg(e.command, 2000)
  58.         end if
  59.     end sub
  60.    
  61.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick
  62.         'msg("myIntVar " & myIntVar.tostring & " myStringVar " & myStringVar & " myHotKey " & myHotKey.tostring, 15)   
  63.        
  64.     end sub
  65.        
  66.     function rotateVec(vec as vector3, angle as double)
  67.         angle = angle * (3.1415 / 180)
  68.        
  69.         dim s as double = system.math.sin(angle)
  70.         dim c as double = system.math.cos(angle)
  71.        
  72.         vec.x = vec.x * c - vec.y * s
  73.         vec.y = vec.x * s + vec.y * c
  74.        
  75.         return vec
  76.     end function
  77. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement