-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMain.cs
45 lines (34 loc) · 1.23 KB
/
Main.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using GTA;
using KlangRageAudioLibrary.Utility;
using System;
namespace KlangRageAudioLibrary
{
public class Main : Script
{
public static Ped PlayerPed => Game.Player.Character;
public static Vehicle PlayerVehicle => PlayerPed.CurrentVehicle;
private static ExternalThread externalThread;
public static bool GamePaused = false;
public Main()
{
Version version = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
DateTime buildDate = new DateTime(2000, 1, 1)
.AddDays(version.Build).AddSeconds(version.Revision * 2);
System.IO.File.AppendAllText($"./ScriptHookVDotNet.log", $"KlangRageAudioLibrary - {version} ({buildDate})" + Environment.NewLine);
Tick += OnTick;
Aborted += OnAbort;
externalThread = new ExternalThread();
externalThread.Start();
}
private void OnTick(object sender, EventArgs e)
{
GamePaused = false;
AudioEngine.TickAll();
}
private static void OnAbort(object sender, EventArgs e)
{
externalThread?.Stop();
AudioEngine.DisposeAll();
}
}
}