-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathOther.lua
More file actions
360 lines (293 loc) · 10.6 KB
/
Copy pathOther.lua
File metadata and controls
360 lines (293 loc) · 10.6 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
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
------------------------------------------
-- Other Options
------------------------------------------
local Other_Options <const> = menu.list(Menu_Root, "其它选项", {}, "")
Dev_Options = menu.list(Other_Options, "开发者选项", {}, "")
--#region Local Editor
local Local_Editor <const> = menu.list(Other_Options, "Local Editor", { "LocalEditor" }, "")
local LocalEditor = {
Menu = {},
script = "",
address1 = 0,
address2 = 0,
type = "int",
write = "",
Lock = {},
}
function LocalEditor.checkScript(script)
if script == "" then
util.toast("请先选择脚本")
return false
end
if not IS_SCRIPT_RUNNING(script) then
util.toast("该脚本未运行")
return false
end
return true
end
LocalEditor.Menu.SelectScript = menu.list(Local_Editor, "选择脚本: 未选择", {}, "")
menu.text_input(LocalEditor.Menu.SelectScript, "输入脚本名称", { "LocalScriptName" }, "",
function(value, click_type)
if value == "" then
LocalEditor.script = ""
menu.set_menu_name(LocalEditor.Menu.SelectScript, "选择脚本: 未选择")
return
end
if not SCRIPT.DOES_SCRIPT_EXIST(value) then
util.toast("不存在该脚本")
return
end
LocalEditor.script = value
menu.set_menu_name(LocalEditor.Menu.SelectScript, "选择脚本: " .. LocalEditor.script)
end)
menu.list_action(LocalEditor.Menu.SelectScript, "常用脚本列表", {}, "", {
{ 1, "fm_mission_controller" },
{ 2, "fm_mission_controller_2020" },
{ 3, "freemode" },
}, function(index, name)
menu.trigger_commands("LocalScriptName " .. name)
end)
menu.slider(Local_Editor, "地址1", { "LocalAddr1" }, "",
0, HIGHEST_INT, 0, 1, function(value)
LocalEditor.address1 = value
end)
menu.slider(Local_Editor, "地址2", { "LocalAddr2" }, "",
0, HIGHEST_INT, 0, 1, function(value)
LocalEditor.address2 = value
end)
menu.list_select(Local_Editor, "数值类型", {}, "", {
{ 1, "INT" },
{ 2, "FLOAT" }
}, 1, function(value, name)
LocalEditor.type = string.lower(name)
end)
menu.divider(Local_Editor, "读")
menu.action(Local_Editor, "读取", {}, "", function()
local script = LocalEditor.script
local address = LocalEditor.address1 + LocalEditor.address2
local dataType = LocalEditor.type
if not LocalEditor.checkScript(script) then
return
end
local value
if dataType == "int" then
value = LOCAL_GET_INT(script, address)
elseif dataType == "float" then
value = LOCAL_GET_FLOAT(script, address)
end
if value ~= nil then
menu.set_value(LocalEditor.Menu.Value, value)
else
menu.set_value(LocalEditor.Menu.Value, "NULL")
end
end)
LocalEditor.Menu.Value = menu.readonly(Local_Editor, "值")
menu.divider(Local_Editor, "写")
menu.text_input(Local_Editor, "要写入的值", { "LocalWriteValue" }, "务必注意int类型和float类型的格式", function(value, click_type)
if click_type == CLICK_BULK then return end
value = tonumber(value)
if value == nil then
util.toast("数值格式错误")
return
end
LocalEditor.write = value
end)
menu.action(Local_Editor, "写入", {}, "", function()
local script = LocalEditor.script
local address = LocalEditor.address1 + LocalEditor.address2
local dataType = LocalEditor.type
local value = tonumber(LocalEditor.write)
if value == nil then
util.toast("请输入要写入的值")
return
end
if not LocalEditor.checkScript(script) then
return
end
if dataType == "int" then
LOCAL_SET_INT(script, address, value)
elseif dataType == "float" then
LOCAL_SET_FLOAT(script, address, value)
end
end)
menu.divider(Local_Editor, "锁定")
menu.action(Local_Editor, "锁定写入", {}, "", function()
local script = LocalEditor.script
local address = LocalEditor.address1 + LocalEditor.address2
local dataType = LocalEditor.type
local value = tonumber(LocalEditor.write)
if value == nil then
util.toast("请输入要写入的值")
return
end
if not LocalEditor.checkScript(script) then
return
end
local menu_name = string.format("Local_%s = %s (%s)", address, value, script)
local help_name = string.format("Script: %s\nType: %s", script, dataType)
local menu_toggle_loop = menu.toggle_loop(LocalEditor.Menu.Lock, menu_name, {}, help_name, function()
if not IS_SCRIPT_RUNNING(script) then
return
end
if dataType == "int" then
LOCAL_SET_INT(script, address, value)
elseif dataType == "float" then
LOCAL_SET_FLOAT(script, address, value)
end
end)
menu.set_value(menu_toggle_loop, true)
table.insert(LocalEditor.Lock, menu_toggle_loop)
util.toast("已添加到锁定写入列表")
end)
LocalEditor.Menu.Lock = menu.list(Local_Editor, "锁定写入列表", {}, "")
menu.action(LocalEditor.Menu.Lock, "清空列表", {}, "", function()
for _, command in pairs(LocalEditor.Lock) do
menu.default_and_delete(command)
end
menu.collect_garbage()
LocalEditor.Lock = {}
end)
--#endregion
--#region Global Editor
local Global_Editor <const> = menu.list(Other_Options, "Global Editor", { "GlobalEditor" }, "")
local GlobalEditor = {
Menu = {},
address1 = 262145,
address2 = 0,
type = "int",
write = "",
Lock = {},
}
menu.slider(Global_Editor, "地址1", { "GlobalAddr1" }, "",
0, HIGHEST_INT, 262145, 1, function(value)
GlobalEditor.address1 = value
end)
menu.slider(Global_Editor, "地址2", { "GlobalAddr2" }, "",
0, HIGHEST_INT, 0, 1, function(value)
GlobalEditor.address2 = value
end)
menu.list_select(Global_Editor, "数值类型", {}, "", {
{ 1, "INT" }, { 2, "FLOAT" }
}, 1, function(value, name)
GlobalEditor.type = string.lower(name)
end)
menu.divider(Global_Editor, "读")
menu.action(Global_Editor, "读取", {}, "", function()
local address = GlobalEditor.address1 + GlobalEditor.address2
local dataType = GlobalEditor.type
local value
if dataType == "int" then
value = GLOBAL_GET_INT(address)
elseif dataType == "float" then
value = GLOBAL_GET_FLOAT(address)
end
if value ~= nil then
menu.set_value(GlobalEditor.Menu.Value, value)
else
menu.set_value(GlobalEditor.Menu.Value, "NULL")
end
end)
GlobalEditor.Menu.Value = menu.readonly(Global_Editor, "值")
menu.divider(Global_Editor, "写")
menu.text_input(Global_Editor, "要写入的值", { "GlobalWriteValue" }, "务必注意int类型和float类型的格式", function(value, click_type)
if click_type == CLICK_BULK then return end
value = tonumber(value)
if value == nil then
util.toast("数值格式错误")
return
end
GlobalEditor.write = value
end)
menu.action(Global_Editor, "写入", {}, "", function()
local address = GlobalEditor.address1 + GlobalEditor.address2
local dataType = GlobalEditor.type
local value = tonumber(GlobalEditor.write)
if value == nil then
util.toast("请输入要写入的值")
return
end
if dataType == "int" then
GLOBAL_SET_INT(address, value)
elseif dataType == "float" then
GLOBAL_SET_FLOAT(address, value)
end
end)
menu.divider(Global_Editor, "锁定")
menu.action(Global_Editor, "锁定写入", {}, "", function()
local address = GlobalEditor.address1 + GlobalEditor.address2
local dataType = GlobalEditor.type
local value = tonumber(GlobalEditor.write)
if value == nil then
util.toast("请输入要写入的值")
return
end
local menu_name = string.format("Global_%s = %s", address, value)
local menu_toggle_loop = menu.toggle_loop(GlobalEditor.Menu.Lock, menu_name, {}, "", function()
if dataType == "int" then
GLOBAL_SET_INT(address, value)
elseif dataType == "float" then
GLOBAL_SET_FLOAT(address, value)
end
end)
menu.set_value(menu_toggle_loop, true)
table.insert(GlobalEditor.Lock, menu_toggle_loop)
util.toast("已添加到锁定写入列表")
end)
GlobalEditor.Menu.Lock = menu.list(Global_Editor, "锁定写入列表", {}, "")
menu.action(GlobalEditor.Menu.Lock, "清空列表", {}, "", function()
for _, command in pairs(GlobalEditor.Lock) do
menu.default_and_delete(command)
end
menu.collect_garbage()
GlobalEditor.Lock = {}
end)
--#endregion
local nophonespam = menu.ref_by_path("Game>Disables>Straight To Voicemail", 55)
menu.toggle_loop(Other_Options, "打字时禁用来电电话", {}, "避免在打字时有电话把输入框挤掉",
function()
if chat.is_open() then
if not menu.get_value(nophonespam) then
menu.set_value(nophonespam, true)
end
else
if menu.get_value(nophonespam) then
menu.set_value(nophonespam, false)
end
end
end, function()
menu.set_value(nophonespam, false)
end)
menu.toggle_loop(Other_Options, "跳到下一条对话", { "skipTalk" }, "快速跳过对话", function()
if AUDIO.IS_SCRIPTED_CONVERSATION_ONGOING() then
AUDIO.SKIP_TO_NEXT_SCRIPTED_CONVERSATION_LINE()
end
end)
menu.toggle_loop(Other_Options, "停止对话", { "stopTalk" }, "快速跳过对话", function()
if AUDIO.IS_SCRIPTED_CONVERSATION_ONGOING() then
AUDIO.STOP_SCRIPTED_CONVERSATION(false)
end
end)
menu.toggle_loop(Other_Options, "自动收集财物", { "autoCollect" }, "模拟鼠标左键点击,用于拿取目标财物时", function()
if TASK.GET_IS_TASK_ACTIVE(players.user_ped(), 135) then
PAD.SET_CONTROL_VALUE_NEXT_FRAME(0, 237, 1)
util.yield(30)
end
end)
menu.toggle_loop(Other_Options, "步行时第一/三人称快捷切换", { "footCamView" }, "步行时第一人称视角和第三人称近距离视角快捷切换", function()
if CAM.IS_FOLLOW_PED_CAM_ACTIVE() then
if CAM.GET_FOLLOW_PED_CAM_VIEW_MODE() == 1 or CAM.GET_FOLLOW_PED_CAM_VIEW_MODE() == 2 then
CAM.SET_FOLLOW_PED_CAM_VIEW_MODE(4)
end
end
end)
menu.action(Other_Options, "清除帮助文本信息", { "clsHelpMsg" }, "", function()
HUD.CLEAR_ALL_HELP_MESSAGES()
end)
menu.action(Other_Options, "EXPLODE_VEHICLE_IN_CUTSCENE", { "cutExplodeVeh" }, "", function()
for _, vehicle in pairs(entities.get_all_vehicles_as_handles()) do
if vehicle ~= entities.get_user_personal_vehicle_as_handle() then
request_control(vehicle, 500)
VEHICLE.EXPLODE_VEHICLE_IN_CUTSCENE(vehicle, false)
end
end
end)