1. 'https://www.youtube.com/user/GTAScripting
  2. 'http://gtaxscripting.blogspot.com/
  3. 'http://www.facebook.com/GtaIVScripting
  4. 'https://twitter.com/julionib
  5.  
  6. Imports System
  7. Imports GTA
  8. Imports System.Drawing
  9. Imports System.Windows.Forms
  10.  
  11. Public Class ScriptDevelopment
  12.     Inherits Script
  13.  
  14.     Private soundID As Int32
  15.  
  16.     Private externalSound As System.Media.SoundPlayer
  17.  
  18.     Public Sub New()
  19.         Me.Interval = 10
  20.  
  21.         soundID = Native.Function.Call(Of Int32)("GET_SOUND_ID")
  22.  
  23.         externalSound = New System.Media.SoundPlayer
  24.         externalSound.SoundLocation = ".\Scripts\myExternalSound.wav"
  25.         externalSound.Load()
  26.     End Sub
  27.  
  28.     Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
  29.         If e.Key = Keys.NumPad0 Then
  30.             For Each o As GTA.Object In World.GetAllObjects
  31.                If Exists(o) AndAlso (o.Position.DistanceTo(Player.Character.Position) < 5) Then
  32.                   Native.Function.Call("PLAY_SOUND_FROM_OBJECT", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", o)
  33.  
  34.                   o.AttachBlip()
  35.  
  36.                   msg("Playing sound from object...", 2000)
  37.  
  38.                   Exit For
  39.                End If
  40.             Next
  41.         End If
  42.  
  43.         If e.Key = Keys.NumPad1 Then
  44.             Native.Function.Call("PLAY_SOUND_FROM_PED", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", Player.Character)
  45.  
  46.             msg("Playing sound from ped...", 2000)
  47.         End If
  48.  
  49.         If e.Key = Keys.NumPad2 Then
  50.             Dim tmpPos As Vector3 = Player.Character.Position.Around(5)
  51.  
  52.             Native.Function.Call("PLAY_SOUND_FROM_POSITION", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", tmpPos.X, tmpPos.Y, tmpPos.Z)
  53.  
  54.             msg("Playing sound from position...", 2000)
  55.         End If
  56.  
  57.         If e.Key = Keys.NumPad3 Then
  58.             If Not Exists(Player.Character.CurrentVehicle) Then
  59.                 msg("Enter in an vehicle first...", 2000)
  60.  
  61.                 Exit Sub
  62.             End If
  63.  
  64.             Native.Function.Call("PLAY_SOUND_FROM_VEHICLE", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", Player.Character.CurrentVehicle)
  65.  
  66.             msg("Playing sound from vehicle...", 2000)
  67.         End If
  68.  
  69.         If e.Key = Keys.NumPad4 Then
  70.             Native.Function.Call("PLAY_SOUND_FRONTEND", soundID, "GENERAL_WEAPONS_ROCKET_LOOP")
  71.  
  72.             msg("Playing sound ''FRONTEND''...", 2000)
  73.         End If
  74.  
  75.         If e.Key = Keys.Back Then
  76.             Native.Function.Call("stop_sound", soundID)
  77.  
  78.             msg("Stopping sound...", 2000)
  79.         End If
  80.  
  81.         If e.Key = Keys.Delete Then
  82.             Native.Function.Call("release_sound_id", soundID)
  83.  
  84.             msg("Releasing sound ID...", 2000)
  85.  
  86.             soundID = -1
  87.         End If
  88.  
  89.         If e.Key = Keys.Add Then
  90.             externalSound.Play()
  91.         End If
  92.     End Sub
  93.  
  94.     Shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
  95.     End Sub
  96.  
  97.     Private Sub general_tick(ByVal sender As Object, ByVal ev As EventArgs) Handles MyBase.Tick
  98.        
  99.     End Sub
  100.  
  101.     Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
  102.     End Sub
  103.  
  104.     Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
  105.     End Sub
  106.  
  107.     Private Sub msg(ByVal sMsg As String, ByVal time As Int32)
  108.         Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
  109.     End Sub
  110.  
  111.     Private Function intervalFix() As Double
  112.         Return Me.Interval * (Game.FPS / 25)
  113.     End Function
  114. End Class