'https://www.youtube.com/user/GTAScripting
'http://gtaxscripting.blogspot.com/
'http://www.facebook.com/GtaIVScripting
'https://twitter.com/julionib
Imports System
Imports GTA
Imports System.Drawing
Imports System.Windows.Forms
Public Class ScriptDevelopment
Inherits Script
Private soundID As Int32
Private externalSound As System.Media.SoundPlayer
Public Sub New()
Me.Interval = 10
soundID = Native.Function.Call(Of Int32)("GET_SOUND_ID")
externalSound = New System.Media.SoundPlayer
externalSound.SoundLocation = ".\Scripts\myExternalSound.wav"
externalSound.Load()
End Sub
Shadows Sub keyDown(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyDown
If e.Key = Keys.NumPad0 Then
For Each o As GTA.Object In World.GetAllObjects
If Exists(o) AndAlso (o.Position.DistanceTo(Player.Character.Position) < 5) Then
Native.Function.Call("PLAY_SOUND_FROM_OBJECT", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", o)
o.AttachBlip()
msg("Playing sound from object...", 2000)
Exit For
End If
Next
End If
If e.Key = Keys.NumPad1 Then
Native.Function.Call("PLAY_SOUND_FROM_PED", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", Player.Character)
msg("Playing sound from ped...", 2000)
End If
If e.Key = Keys.NumPad2 Then
Dim tmpPos As Vector3 = Player.Character.Position.Around(5)
Native.Function.Call("PLAY_SOUND_FROM_POSITION", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", tmpPos.X, tmpPos.Y, tmpPos.Z)
msg("Playing sound from position...", 2000)
End If
If e.Key = Keys.NumPad3 Then
If Not Exists(Player.Character.CurrentVehicle) Then
msg("Enter in an vehicle first...", 2000)
Exit Sub
End If
Native.Function.Call("PLAY_SOUND_FROM_VEHICLE", soundID, "GENERAL_WEAPONS_ROCKET_LOOP", Player.Character.CurrentVehicle)
msg("Playing sound from vehicle...", 2000)
End If
If e.Key = Keys.NumPad4 Then
Native.Function.Call("PLAY_SOUND_FRONTEND", soundID, "GENERAL_WEAPONS_ROCKET_LOOP")
msg("Playing sound ''FRONTEND''...", 2000)
End If
If e.Key = Keys.Back Then
Native.Function.Call("stop_sound", soundID)
msg("Stopping sound...", 2000)
End If
If e.Key = Keys.Delete Then
Native.Function.Call("release_sound_id", soundID)
msg("Releasing sound ID...", 2000)
soundID = -1
End If
If e.Key = Keys.Add Then
externalSound.Play()
End If
End Sub
Shadows Sub keyUp(ByVal sender As Object, ByVal e As GTA.KeyEventArgs) Handles MyBase.KeyUp
End Sub
Private Sub general_tick(ByVal sender As Object, ByVal ev As EventArgs) Handles MyBase.Tick
End Sub
Private Sub console_CMD(ByVal sender As Object, ByVal e As ConsoleEventArgs) Handles MyBase.ConsoleCommand
End Sub
Private Sub GraphicsEventHandler(ByVal sender As Object, ByVal e As GTA.GraphicsEventArgs) Handles MyBase.PerFrameDrawing
End Sub
Private Sub msg(ByVal sMsg As String, ByVal time As Int32)
Native.Function.Call("PRINT_STRING_WITH_LITERAL_STRING_NOW", "STRING", sMsg, time, 1)
End Sub
Private Function intervalFix() As Double
Return Me.Interval * (Game.FPS / 25)
End Function
End Class