Jump to content

Play External Audio From Coordinates [Help]


Stagnant09

Recommended Posts

Hi. I'd like to create a non-stop sound player for a club (in C#, with ScriptHook). I use:

 

private Vector3 musicPlayerLocation = new Vector3(0.0f, 0.0f, 0.0f);

to identify the club's supposed "speaker" position and:

private string trackPath = "./CustomAudio/track1.ogg";
//...
UI.Notify("Playing Sound");
Function.Call(Hash.PLAY_SOUND_FROM_COORD, -1, trackPath, musicPlayerLocation.X, musicPlayerLocation.Y, musicPlayerLocation.Z, 0, 0, 0, 0);

in order to play the sound. Despite the fact that I'm getting notified with "Playing Sound", the command "Function.Call..." doesn't actually work at all. I've successfully used it, though, only for in-game sounds like "Heist Passed". I've tried this also with an external .mp3 and a .wav sound file but this didn't work either.

 

Any ideas?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • 1 User Currently Viewing
    0 members, 0 Anonymous, 1 Guest

×
×
  • Create New...

Important Information

By using GTAForums.com, you agree to our Terms of Use and Privacy Policy.