#if FIVEM
using CitizenFX.Core;
using CitizenFX.Core.Native;
#elif RAGEMP
using RAGE.Game;
#elif RPH
using Rage;
using Rage.Native;
#elif SHVDN3
using GTA;
using GTA.Native;
#endif
namespace LemonUI
{
///
/// Contains information for a Game Sound that is played at specific times.
///
public class Sound
{
///
/// The Set where the sound is located.
///
public string Set { get; set; }
///
/// The name of the sound file.
///
public string File { get; set; }
///
/// Creates a new class with the specified Sound Set and File.
///
/// The Set where the sound is located.
/// The name of the sound file.
public Sound(string set, string file)
{
Set = set;
File = file;
}
///
/// Plays the sound for the local .
///
public void PlayFrontend()
{
#if FIVEM
API.PlaySoundFrontend(-1, File, Set, false);
int id = API.GetSoundId();
API.ReleaseSoundId(id);
#elif RAGEMP
Invoker.Invoke(Natives.PlaySoundFrontend, -1, File, Set, false);
int id = Invoker.Invoke(Natives.GetSoundId);
Invoker.Invoke(Natives.ReleaseSoundId, id);
#elif RPH
NativeFunction.CallByHash(0x67C540AA08E4A6F5, -1, File, Set, false);
int id = NativeFunction.CallByHash(0x430386FE9BF80B45);
NativeFunction.CallByHash(0x353FC880830B88FA, id);
#elif SHVDN3
Function.Call(Hash.PLAY_SOUND_FRONTEND, -1, File, Set, false);
int id = Function.Call(Hash.GET_SOUND_ID);
Function.Call(Hash.RELEASE_SOUND_ID, id);
#endif
}
}
}