-
Notifications
You must be signed in to change notification settings - Fork 4
/
Main.cs
99 lines (82 loc) · 2.84 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
using GTA;
using GTA.Native;
using System;
using System.Linq;
namespace FusionLibrary
{
internal class Main : Script
{
public static Version Version => System.Reflection.Assembly.GetExecutingAssembly().GetName().Version;
public Main()
{
DateTime buildDate = new DateTime(2000, 1, 1).AddDays(Version.Build).AddSeconds(Version.Revision * 2);
System.IO.File.AppendAllText($"./ScriptHookVDotNet.log", $"FusionLibrary - {Version} ({buildDate})" + Environment.NewLine);
Tick += Main_Tick;
}
private void Main_Tick(object sender, EventArgs e)
{
if (Game.IsLoading)
{
return;
}
if (FusionUtils.FirstTick)
{
// Bypass models check
IntPtr addr = Game.FindPattern("48 85 C0 0F 84 ? ? ? ? 8B 48 50");
if (addr != IntPtr.Zero)
{
for (int i = 0; i < 24; i++)
{
unsafe
{
byte* val = (byte*)(addr + i);
*val = 0x90;
}
}
}
Decorator.Initialize();
TrafficHandler.Init();
}
FusionUtils.AllVehicles = World.GetAllVehicles().ToList();
AnimatePropsHandler.TickAll();
AnimateProp.TickAll();
ParticlePlayerHandler.TickAll();
ParticlePlayer.TickAll();
CustomCameraHandler.TickAll();
InteractiveController.TickAll();
CustomNativeMenu.ObjectPool.Process();
CustomNativeMenu.TickAll();
ScreenFlash.Tick();
PlayerSwitch.Tick();
NativeInput.TickAll();
ScreenFade.Tick();
if (PlayerSwitch.Disable)
{
Game.DisableControlThisFrame(Control.CharacterWheel);
}
if (FusionUtils.HideGUI)
{
Function.Call(Hash.HIDE_HUD_AND_RADAR_THIS_FRAME);
}
if (FusionUtils.HelpText != null)
{
GTA.UI.Screen.ShowHelpTextThisFrame($"{FusionUtils.HelpText}");
FusionUtils.HelpText = null;
}
if (FusionUtils.SubtitleText != null)
{
GTA.UI.Screen.ShowSubtitle($"{FusionUtils.SubtitleText}");
FusionUtils.SubtitleText = null;
}
if (FusionUtils.NotificationText != null)
{
GTA.UI.Notification.Show($"{FusionUtils.NotificationText}");
FusionUtils.NotificationText = null;
}
if (FusionUtils.FirstTick)
{
FusionUtils.FirstTick = false;
}
}
}
}