using System;
using System.Reflection;
using System.Drawing;
using GTA;
using GTA.Math;
using GTA.Native;
using SwitchExtensionClasses;
using System.Globalization;
I use Naudio.dll to play custom sounds from an audio folder in my scripts folders.
namespace Playsound
{
public class cPlaysound : Script
{
private NAudio.Wave.WaveFileReader wave01 = null;
private NAudio.Wave.DirectSoundOut output01 = null;
private Ped PlayerPed;
private Player CurrentPlayer;
private Vehicle PlayerVehicle;
public cPlaysound ()
{
Tick += OnTick;
Tick += WelcomeSoundStart;
Interval = 0;
}
void WelcomeSoundStart(object sender, EventArgs e)
{
if (Game.IsControlJustPressed(GTA.Control.VehicleExit))
{
WelcomSound01();
}
else
{
}
void WelcomeSound01()
{
wave01 = new NAudio.Wave.WaveFileReader("./scripts/YOURSCRIPTFOLDER/Audio/YOURWAVENAME.wav");
output01 = new NAudio.Wave.DirectSoundOut();
output01.Init(new NAudio.Wave.WaveChannel32(wave01));
output01.Play();
}
Trying to do this from memory here but could have some errors. Anyway pardner its just to point you in the right direction. Good luck.