-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathf.cs
More file actions
95 lines (87 loc) · 4.69 KB
/
f.cs
File metadata and controls
95 lines (87 loc) · 4.69 KB
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
using GTA;
using GTA.Native;
using System;
using System.Windows.Forms;
public class ModName : Script
{
private bool engineoff = false;
private bool engineon = true;
public static Keys MenuKey;
public static ScriptSettings iniSettings;
private Ped playerPed = Game.Player.Character;
private Player player = Game.Player;
public ModName()
{
SetupScript();
Aborted += new EventHandler(OnAbort);
Tick += new EventHandler(OnTick);
KeyDown += new KeyEventHandler(OnKeyDown);
KeyUp += new KeyEventHandler(OnKeyUp);
}
private void OnAbort(object sender, EventArgs e)
{
}
private void SetupScript()
{
ModName.iniSettings = ScriptSettings.Load("scripts\\enginehotkey.ini");
Keys result;
Enum.TryParse<Keys>(ModName.iniSettings.GetValue("KEYS", "MAIN", "N"), out result);
ModName.MenuKey = result;
}
private void OnTick(object sender, EventArgs e)
{
bool flag = Function.Call<bool>(Hash.IS_USING_KEYBOARD_AND_MOUSE, InputArgument.op_Implicit(2));
if (Game.IsControlJustPressed(2, (Control) 233) && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning && !flag)
{
Function.Call(Hash.REQUEST_ANIM_DICT, "veh@std@ds@base");
Function.Call(Hash.TASK_PLAY_ANIM, Game.Player.Character, "veh@std@ds@base", "change_station", 8f, 1f, 600, 48, 0.1f, 0, 0, 0);
engineoff = true;
engineon = false;
}
if (Game.IsControlJustPressed(2, (Control) 233) && Game.Player.Character.IsInVehicle() && !Game.Player.Character.CurrentVehicle.EngineRunning && !flag)
{
Function.Call(Hash.REQUEST_ANIM_DICT, "veh@std@ds@base");
Function.Call(Hash.TASK_PLAY_ANIM, InputArgument.op_Implicit(Game.Player.Character), "veh@std@ds@base", InputArgument.op_Implicit("change_station"), InputArgument.op_Implicit(8f), InputArgument.op_Implicit(1f), InputArgument.op_Implicit(650), InputArgument.op_Implicit(48), InputArgument.op_Implicit(0.1f), InputArgument.op_Implicit(0), InputArgument.op_Implicit(0), InputArgument.op_Implicit(0));
engineon = true;
engineoff = false;
}
if (engineoff)
{
Function.Call(Hash.SET_VEHICLE_ENGINE_ON, InputArgument.op_Implicit(Game.Player.Character.CurrentVehicle), InputArgument.op_Implicit(false), InputArgument.op_Implicit(false), InputArgument.op_Implicit(true));
engineon = false;
}
if (engineon)
{
Function.Call(Hash.SET_VEHICLE_ENGINE_ON, InputArgument.op_Implicit(Game.Player.Character.CurrentVehicle), InputArgument.op_Implicit(true), InputArgument.op_Implicit(false), InputArgument.op_Implicit(true));
engineoff = false;
}
if (!Game.Player.Character.IsOnFoot || !engineon)
return;
Function.Call(Hash.SET_VEHICLE_ENGINE_ON, InputArgument.op_Implicit(Game.Player.Character.LastVehicle), InputArgument.op_Implicit(true), InputArgument.op_Implicit(true), InputArgument.op_Implicit(false));
}
private void OnKeyDown(object sender, KeyEventArgs e)
{
}
private void OnKeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == ModName.MenuKey && Game.Player.Character.IsInVehicle() && Game.Player.Character.CurrentVehicle.EngineRunning)
{
Function.Call(Hash.REQUEST_ANIM_DICT, "veh@std@ds@base");
Function.Call(Hash.TASK_PLAY_ANIM, InputArgument.op_Implicit(Game.Player.Character), "veh@std@ds@base", InputArgument.op_Implicit("change_station"), InputArgument.op_Implicit(8f), InputArgument.op_Implicit(1f), InputArgument.op_Implicit(600), InputArgument.op_Implicit(48), InputArgument.op_Implicit(0.1f), InputArgument.op_Implicit(0), InputArgument.op_Implicit(0), InputArgument.op_Implicit(0));
engineoff = true;
engineon = false;
}
if (e.KeyCode != ModName.MenuKey || !Game.Player.Character.IsInVehicle() || Game.Player.Character.CurrentVehicle.EngineRunning)
return;
Function.Call(Hash.REQUEST_ANIM_DICT, "veh@std@ds@base");
Function.Call(Hash.TASK_PLAY_ANIM, InputArgument.op_Implicit(Game.Player.Character), "veh@std@ds@base", InputArgument.op_Implicit("change_station"), InputArgument.op_Implicit(8f), InputArgument.op_Implicit(1f), InputArgument.op_Implicit(650), InputArgument.op_Implicit(48), InputArgument.op_Implicit(0.1f), InputArgument.op_Implicit(0), InputArgument.op_Implicit(0), InputArgument.op_Implicit(0));
engineon = true;
engineoff = false;
}
private void DisplayHelpTextThisFrame(string text)
{
Function.Call(Hash.BEGIN_TEXT_COMMAND_DISPLAY_HELP, InputArgument.op_Implicit("STRING"));
Function.Call(Hash.ADD_TEXT_COMPONENT_SUBSTRING_PLAYER_NAME, InputArgument.op_Implicit(text));
Function.Call(Hash.END_TEXT_COMMAND_DISPLAY_HELP, InputArgument.op_Implicit(0), InputArgument.op_Implicit(0), InputArgument.op_Implicit(1), InputArgument.op_Implicit(-1));
}
}