-
Notifications
You must be signed in to change notification settings - Fork 0
/
pi_menu.cs
398 lines (344 loc) · 15 KB
/
pi_menu.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
using GTA;
using GTA.Native;
using GTA.Math;
using GTA.NaturalMotion;
using NativeUI;
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Collections.Generic;
using EnhancedInteractionMenu;
public class PIMenu : Script
{
MenuPool MenuPool = new MenuPool();
public static UIResRectangle GlobalMenuBanner;
UIMenu MainMenu;
UIMenuListItem QuickGPSItem;
UIMenuListItem PlayerMoodItem;
UIMenuListItem WalkStyleItem;
UIMenuListItem AimingStyleItem;
UIMenuItem PassiveModeItem;
UIMenuListItem MenuColorItem;
UIMenu MenuOptionsMenu;
UIMenu AboutMenu;
bool IsPassiveMode = false;
UIMenu InventoryMenu;
public static Color MenuColor;
public PIMenu()
{
Tick += OnTick;
KeyDown += OnKeyDown;
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@brave");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@confident");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@drunk");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@drunk@verydrunk");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@fat@a");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@shadyped@a");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@hurry@a");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@injured");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@intimidation@1h");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@quick");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@sad@a");
Function.Call(Hash.REQUEST_CLIP_SET, "move_m@tool_belt@a");
MenuColor = Color.Blue;
MainMenu = new UIMenu(Game.Player.Name.ToString(), "INTERACTION MENU", new Point(0, 0));
MenuPool.Add(MainMenu);
GlobalMenuBanner = new UIResRectangle();
GlobalMenuBanner.Color = MenuColor;
MainMenu.SetBannerType(GlobalMenuBanner);
MainMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
MainMenu.Title.Scale = 0.86f;
MainMenu.Subtitle.Color = MenuColor;
var QuickGPSList = new List<dynamic>
{
"None",
"Ammu-Nation",
"Convenience Store",
"Mod Shop",
"Clothes Store",
};
MainMenu.AddItem(QuickGPSItem = new UIMenuListItem("Quick GPS", QuickGPSList, 0, "Select to place your waypoint at a set location."));
QuickGPSItem.Activated += (UIMenu sender, UIMenuItem selecteditem) =>
{
var tmpList = (UIMenuListItem)selecteditem;
switch (tmpList.Index)
{
case 0:
Function.Call(Hash.SET_WAYPOINT_OFF);
break;
case 1:
Vector3 NearestAmmunation = PointsOfInterest.GetClosestPoi(Game.Player.Character.Position, PointsOfInterest.Type.AmmuNation);
Function.Call(Hash.SET_NEW_WAYPOINT, NearestAmmunation.X, NearestAmmunation.Y);
break;
}
};
InventoryMenu = new UIMenu(Game.Player.Name.ToString(), "INVENTORY", new Point(0, 0));
MenuPool.Add(InventoryMenu);
InventoryMenu.SetBannerType(GlobalMenuBanner);
InventoryMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
InventoryMenu.Title.Scale = 0.86f;
InventoryMenu.Subtitle.Color = MenuColor;
var InventoryMenuItem = new UIMenuItem("Inventory", "Your inventory which contains clothing, ammo, and much more.");
MainMenu.AddItem(InventoryMenuItem);
MainMenu.BindMenuToItem(InventoryMenu, InventoryMenuItem);
var PlayerMoodsList = new List<dynamic>
{
"None",
"Normal",
"Happy",
"Angry",
"Injured",
"Stressed",
};
MainMenu.AddItem(PlayerMoodItem = new UIMenuListItem("Player Mood", PlayerMoodsList, 0, "Sets your character's facial expression."));
var WalkStyleList = new List<dynamic>
{
"Normal",
"Brave",
"Confident",
"Drunk",
"Fat",
"Gangster",
"Hurry",
"Injured",
"Intimidated",
"Quick ",
"Sad",
"Tough Guy"
};
MainMenu.AddItem(WalkStyleItem = new UIMenuListItem("Walk Style", WalkStyleList, 0, "Sets your Character's walking style."));
var AimingStyleList = new List<dynamic>
{
"None",
"Gangster",
"Cowboy",
};
MainMenu.AddItem(AimingStyleItem = new UIMenuListItem("Aiming Style", AimingStyleList, 0, "Sets your Character's pistol aiming style."));
PassiveModeItem = new UIMenuItem("Enable Passive Mode", "Passive Mode will prevent damage and wanted levels from police.");
MainMenu.AddItem(PassiveModeItem);
MenuOptionsMenu = new UIMenu(Game.Player.Name.ToString(), "MENU OPTIONS", new Point(0, 0));
MenuPool.Add(MenuOptionsMenu);
MenuOptionsMenu.SetBannerType(GlobalMenuBanner);
MenuOptionsMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
MenuOptionsMenu.Title.Scale = 0.86f;
MenuOptionsMenu.Subtitle.Color = MenuColor;
var MenuOptionsMenuItem = new UIMenuItem("Menu Options", "");
MainMenu.AddItem(MenuOptionsMenuItem);
MainMenu.BindMenuToItem(MenuOptionsMenu, MenuOptionsMenuItem);
AboutMenu = new UIMenu(Game.Player.Name.ToString(), "ABOUT", new Point(0, 0));
MenuPool.Add(AboutMenu);
AboutMenu.SetBannerType(GlobalMenuBanner);
AboutMenu.Title.Font = GTA.Font.ChaletComprimeCologne;
AboutMenu.Title.Scale = 0.86f;
AboutMenu.Subtitle.Color = MenuColor;
var AboutOptionsMenuItem = new UIMenuItem("About", "");
MenuOptionsMenu.BindMenuToItem(AboutMenu, AboutOptionsMenuItem);
var MenuColorList = new List<dynamic>
{
"Blue",
"Red",
"Green",
"Orange",
"Purple",
"Yellow",
};
MenuOptionsMenu.AddItem(MenuColorItem = new UIMenuListItem("Color", MenuColorList, 0, "Select interaction menu's color theme."));
MenuOptionsMenu.AddItem(AboutOptionsMenuItem);
var VersionItem = new UIMenuItem("Version");
var AuthorItem = new UIMenuItem("Author");
AboutMenu.AddItem(VersionItem);
AboutMenu.AddItem(AuthorItem);
VersionItem.SetRightLabel("1.0");
AuthorItem.SetRightLabel("jedijosh920 & Guadmaz");
MainMenu.OnItemSelect += (UIMenu sender, UIMenuItem selectedItem, int index) =>
{
switch (index)
{
case 5:
if (!IsPassiveMode)
{
Game.Player.Character.IsInvincible = true;
Game.Player.Character.Alpha = 200;
Function.Call(Hash.SET_POLICE_IGNORE_PLAYER, Game.Player, true);
Function.Call(Hash.SET_WANTED_LEVEL_MULTIPLIER, 0.0f);
PassiveModeItem.Text = "Disable Passive Mode";
IsPassiveMode = true;
}
else if (IsPassiveMode)
{
Game.Player.Character.ResetAlpha();
Function.Call(Hash.SET_POLICE_IGNORE_PLAYER, Game.Player, false);
Function.Call(Hash.SET_WANTED_LEVEL_MULTIPLIER, 1.0f);
PassiveModeItem.Text = "Enable Passive Mode";
IsPassiveMode = false;
}
break;
}
};
MenuOptionsMenu.OnListChange += (UIMenu sender, UIMenuListItem listItem, int newIndex) =>
{
if (listItem == MenuColorItem)
{
switch (newIndex)
{
case 0:
MenuColor = Color.Blue;
break;
case 1:
MenuColor = Color.Red;
break;
case 2:
MenuColor = Color.Green;
break;
case 3:
MenuColor = Color.Orange;
break;
case 4:
MenuColor = Color.Purple;
break;
case 5:
MenuColor = Color.Yellow;
break;
}
}
if (listItem == WalkStyleItem)
{
switch (newIndex)
{
case 0:
Game.Player.Character.Task.ClearAll();
Function.Call(Hash.RESET_PED_MOVEMENT_CLIPSET, Game.Player.Character, 0x3E800000);
break;
case 1:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@brave", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 2:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@confident", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 3:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@drunk@verydrunk", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 4:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@fat@a", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 5:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@shadyped@a", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 6:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@hurry@a", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 7:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@injured", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 8:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@intimidation@1h", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 9:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@quick", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 10:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@sad@a", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
case 11:
Function.Call(Hash.SET_PED_MOVEMENT_CLIPSET, Game.Player.Character, "move_m@tool_belt@a", 0x3E800000);
Game.Player.Character.Task.ClearAll();
break;
}
}
if (listItem == PlayerMoodItem)
{
switch (newIndex)
{
case 0:
Function.Call(Hash.CLEAR_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character);
break;
case 1:
Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "mood_normal_1", 0);
break;
case 2:
Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "mood_happy_1", 0);
break;
case 3:
Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Angry_1", 0);
break;
case 4:
Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Injured_1", 0);
break;
case 5:
Function.Call(Hash.SET_FACIAL_IDLE_ANIM_OVERRIDE, Game.Player.Character, "Mood_Stressed_1", 0);
break;
}
}
if (listItem == AimingStyleItem)
{
switch (newIndex)
{
case 0:
Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "default"));
break;
case 1:
Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "Gang1H"));
break;
case 2:
Function.Call(Hash.SET_WEAPON_ANIMATION_OVERRIDE, Game.Player.Character, Function.Call<int>(Hash.GET_HASH_KEY, "Hillbilly"));
break;
}
}
};
var menu = new AmmoMenu();
var ammoItem = new UIMenuItem("Ammo");
InventoryMenu.AddItem(ammoItem);
InventoryMenu.BindMenuToItem(menu, ammoItem);
MenuPool.Add(menu);
MainMenu.RefreshIndex();
InventoryMenu.RefreshIndex();
}
public static void PrettifyMenu(ref UIMenu menu)
{
menu.Title.Caption = Game.Player.Name;
menu.SetBannerType(GlobalMenuBanner);
menu.Title.Font = GTA.Font.ChaletComprimeCologne;
menu.Title.Scale = 0.86f;
menu.Subtitle.Color = MenuColor;
}
void OnTick(object sender, EventArgs e)
{
Game.DisableControl(2, GTA.Control.InteractionMenu);
MenuPool.ProcessMenus();
if (MenuPool.IsAnyMenuOpen())
{
GlobalMenuBanner.Color = MenuColor;
MainMenu.Subtitle.Color = MenuColor;
InventoryMenu.Subtitle.Color = MenuColor;
MenuOptionsMenu.Subtitle.Color = MenuColor;
AboutMenu.Subtitle.Color = MenuColor;
}
if (IsPassiveMode)
{
Game.Player.WantedLevel = 0;
}
}
void OnKeyDown(object sender, KeyEventArgs e)
{
if (Game.IsControlJustPressed(2, GTA.Control.InteractionMenu) && !MenuPool.IsAnyMenuOpen())
{
Game.PlaySound("SELECT", "HUD_FRONTEND_DEFAULT_SOUNDSET");
MainMenu.Visible = true;
}
else if (Game.IsControlJustPressed(2, GTA.Control.InteractionMenu) && MenuPool.IsAnyMenuOpen())
{
Game.PlaySound("BACK", "HUD_FRONTEND_DEFAULT_SOUNDSET");
MenuPool.CloseAllMenus();
}
}
}