julioCCs

BasicScript8.vb

Nov 4th, 2012
312
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 2.88 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. Imports System.IO
  6.  
  7. Public Class BasicScript
  8.     Inherits Script
  9.        
  10.     private myFont as gta.font
  11.     private myKeyPressed as System.Windows.Forms.keys = 0
  12.     private mySpeedoBack as texture = nothing
  13.     private mySpeedoArrow as texture = nothing
  14.        
  15.     Public Sub New()
  16.         Me.interval = 10   
  17.  
  18.         myFont = new gta.font
  19.         myFont.color = System.Drawing.Color.white
  20.        
  21.         try
  22.             if file.exists(".\scripts\SpeedoMBack.png") then mySpeedoBack = new Texture(File.ReadAllBytes(".\scripts\SpeedoMBack.png"))
  23.             if file.exists(".\scripts\SpeedoMG.png") then mySpeedoArrow = new Texture(File.ReadAllBytes(".\scripts\SpeedoMG.png"))
  24.         catch
  25.         end try
  26.     End Sub
  27.    
  28.     private sub msg(sMsg as string, time as int32)
  29.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  30.     end sub
  31.    
  32.     Private Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  33.         myKeyPressed = e.key
  34.     End Sub
  35.     Private Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  36.     end sub
  37.    
  38.     private sub cmd(ByVal sender As Object, ByVal e As GTA.ConsoleEventArgs) Handles MyBase.ConsoleCommand     
  39.     end sub
  40.    
  41.     Private Sub general_tick(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Tick     
  42.         if game.iskeypressed(keys.shiftkey) andalso exists(player.character.currentvehicle) then player.character.currentvehicle.applyforce(player.character.currentvehicle.direction)
  43.     end sub
  44.    
  45.     public sub myGraph(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  46.         e.graphics.DrawLine(10, 10, 100, 10, 10.0, System.Drawing.Color.white)
  47.         e.graphics.DrawRectangle(50, 50, 50, 50, System.Drawing.Color.red)
  48.         e.graphics.DrawText(myKeyPressed.tostring, 200, 10, System.Drawing.Color.yellow, myFont)
  49.        
  50.         if exists(player.character.currentvehicle) andalso exists(mySpeedoBack) andalso exists(mySpeedoArrow) then
  51.             e.graphics.DrawSprite(mySpeedoBack, 150, 300, 300, 300, 0, System.Drawing.Color.white)     
  52.             e.graphics.DrawSprite(mySpeedoArrow, 150, 315, 300, 300, (player.character.currentvehicle.speed * 3) * (3.1415 / 180), System.Drawing.Color.white)
  53.             e.graphics.DrawText(player.character.currentvehicle.speed.tostring, 10, 200)
  54.            
  55.             '0 mph = 0º
  56.             '15 mph = 45º
  57.             '30 mph = 90º
  58.             '45 mph = 135º
  59.             '60 mph = 180º
  60.         end if
  61.     end sub
  62.        
  63.     function rotateVec(vec as vector3, angle as double)
  64.         angle = angle * (3.1415 / 180)
  65.        
  66.         dim s as double = system.math.sin(angle)
  67.         dim c as double = system.math.cos(angle)
  68.        
  69.         vec.x = vec.x * c - vec.y * s
  70.         vec.y = vec.x * s + vec.y * c
  71.        
  72.         return vec
  73.     end function
  74. End Class
Advertisement
Add Comment
Please, Sign In to add comment