-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexamples.lua
More file actions
460 lines (433 loc) · 13.5 KB
/
Copy pathexamples.lua
File metadata and controls
460 lines (433 loc) · 13.5 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
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
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
-- Pattern Lock
RegisterCommand('testpattern', function()
local correctPattern = {1,4,7,8,9} -- Diagonal pattern from top-left to bottom-right
exports['moon-ui']:OpenPatternLock(correctPattern, function(success)
if success then
print('Pattern correct! Access granted.')
-- Add your logic here for successful pattern entry
else
print('Pattern incorrect! Access denied.')
-- Add your logic here for failed pattern entry
end
end)
end)
-- PIN Lock
RegisterCommand('testpin', function()
local correctPin = "123456" -- 6-digit PIN code
exports['moon-ui']:OpenPinLock(correctPin, function(success)
if success then
print('PIN correct! Access granted.')
-- Add your logic here for successful PIN entry
else
print('PIN incorrect! Access denied.')
-- Add your logic here for failed PIN entry
end
end)
end)
-- Keypad Lock
RegisterCommand('testkeypad', function()
local correctCode = "A1B2C3" -- Alphanumeric code
exports['moon-ui']:OpenKeypadLock(correctCode, function(success)
if success then
print('Code correct! Access granted.')
-- Add your logic here for successful code entry
else
print('Code incorrect! Access denied.')
-- Add your logic here for failed code entry
end
end)
end)
-- Color Sequence Lock
RegisterCommand('testcolor', function()
local correctSequence = {"red", "blue", "green", "yellow"} -- Color sequence
exports['moon-ui']:OpenColorSequenceLock(correctSequence, function(success)
if success then
print('Color sequence correct! Access granted.')
-- Add your logic here for successful sequence entry
else
print('Color sequence incorrect! Access denied.')
-- Add your logic here for failed sequence entry
end
end)
end)
-- Gesture Lock
RegisterCommand('testgesture', function()
local correctGesture = {
{ x = 100, y = 100 },
{ x = 200, y = 200 },
{ x = 300, y = 100 }
} -- "V" shaped gesture
exports['moon-ui']:OpenGestureLock(correctGesture, function(success)
if success then
print('Gesture correct! Access granted.')
-- Add your logic here for successful gesture entry
else
print('Gesture incorrect! Access denied.')
-- Add your logic here for failed gesture entry
end
end)
end)
-- Swipe Lock
RegisterCommand('testswipe', function()
exports['moon-ui']:OpenSwipeLock(function(success)
if success then
print('Swipe successful! Access granted.')
-- Add your logic here for successful swipe
else
print('Swipe cancelled.')
-- Add your logic here for cancelled swipe
end
end)
end)
-- Key Card Swipe Lock
RegisterCommand('testkeycard', function()
exports['moon-ui']:OpenKeycardLock('id_card', function(success) -- Suports Ox_inv qb_inv and Qs_inv
if success then
print('Keycard found and swipe accepted!')
-- Add your logic here for successful swipe
else
print('No keycard found or swipe denied!')
-- Add your logic here for failed swipe
end
end)
end)
-- Math Puzzle Lock
RegisterCommand('testmath', function()
exports['moon-ui']:OpenMathPuzzleLock(function(success)
if success then
print('Math puzzle solved! Access granted.')
-- Add your logic here for successful puzzle completion
else
print('Math puzzle failed! Access denied.')
-- Add your logic here for failed puzzle attempt
end
end)
end)
-- Anagram Lock
RegisterCommand('testanagram', function()
-- Difficulty can be 'easy', 'medium', or 'hard'
exports['moon-ui']:OpenAnagramLock('medium', function(success)
if success then
print('Anagram solved! Access granted.')
else
print('Anagram incorrect! Access denied.')
end
end)
end)
-- Maze Navigation Lock
RegisterCommand('testmaze', function()
exports['moon-ui']:OpenMazeNavigationLock(function(success)
if success then
print('Maze completed! Access granted.')
else
print('Maze failed! Access denied.')
end
end)
end)
-- Wire Cutting Lock
RegisterCommand('testwire', function()
exports['moon-ui']:OpenWireCuttingLock(function(success)
if success then
print('Correct wire cut! Access granted.')
else
print('Wrong wire cut! Access denied.')
end
end)
end)
-- Safe Cracking Lock
RegisterCommand('testsafe', function()
local correctCombination = {25, 50, 75} -- Three-number combination
exports['moon-ui']:OpenSafeCrackingLock(correctCombination, function(success)
if success then
print('Safe cracked! Access granted.')
else
print('Wrong combination! Access denied.')
end
end)
end)
-- Precision Ring Lock
RegisterCommand('testprecision', function()
exports['moon-ui']:OpenPrecisionRingLock(function(success)
if success then
print('Precision lock completed! Access granted.')
else
print('Precision lock failed! Access denied.')
end
end, 2, 20, 2) -- speed, targetSize, requiredHits
end)
-- Display Image
RegisterCommand('testimage', function()
local imageUrl = "https://images.pexels.com/photos/3052361/pexels-photo-3052361.jpeg" -- Example Pexels image
exports['moon-ui']:OpenImage(imageUrl, function(success)
if success then
print('Image opened successfully.')
else
print('Failed to open image.')
end
end, "1234") -- Pass nil instead of "1234" for no password protection
end)
RegisterCommand('testinput', function()
local fields = {
{
id = 'name',
label = 'Full Name',
type = 'text',
icon = 'user',
placeholder = 'Enter your full name',
required = true
},
{
id = 'email',
label = 'Email Address',
type = 'email',
icon = 'mail',
placeholder = 'your@email.com',
required = true,
pattern = '[a-z0-9._%-]@[a-z0-9.-]\\.[a-z]{2,}$'
},
{
id = 'password',
label = 'Password',
type = 'password',
icon = 'lock',
placeholder = 'Enter your password',
required = true
},
{
id = 'phone',
label = 'Phone Number',
type = 'tel',
icon = 'phone',
placeholder = '(123) 456-7890',
pattern = '\\([0-9]{3}\\) [0-9]{3}-[0-9]{4}'
},
{
id = 'birthdate',
label = 'Date of Birth',
type = 'date',
icon = 'calendar'
},
{
id = 'time',
label = 'Preferred Time',
type = 'time',
icon = 'clock'
},
{
id = 'website',
label = 'Website',
type = 'url',
icon = 'globe',
placeholder = 'https://example.com'
},
{
id = 'age',
label = 'Age',
type = 'number',
icon = 'hash',
min = 18,
max = 100
},
{
id = 'price',
label = 'Price',
type = 'number',
icon = 'dollar-sign',
step = 0.01,
min = 0
},
{
id = 'bio',
label = 'Biography',
type = 'textarea',
icon = 'file-text',
placeholder = 'Tell us about yourself'
}
}
local input = exports['moon-ui']:Input(fields, "Registration Form") -- title parameter
if input then
for k, v in pairs(input) do
print(k, v)
end
else
print('Input Form Cancelled')
end
end)
-- Alert Dialog
RegisterCommand('testalert', function()
exports['moon-ui']:OpenAlertDialog(
"Confirmation", -- Title
"Are you sure you want to proceed?", -- Description
"Cancel", -- Cancel Text
"Confirm", -- Confirm Button Text
function(success)
if success then
print('Dialog confirmed!')
else
print('Dialog cancelled!')
end
end
)
end)
-- Context menu with submenu
RegisterCommand('vehiclemenu', function()
exports['moon-ui']:CreateMenu({
{
id = "vehicle_menu",
header = "Vehicle Controls",
text = "Basic vehicle controls",
icon = "fas fa-car",
subMenu = {
{
id = "engine_toggle",
header = "Toggle Engine",
icon = "fas fa-engine-warning",
action = function()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
local isOn = GetIsVehicleEngineRunning(vehicle)
SetVehicleEngineOn(vehicle, not isOn, false, true)
end
},
{
id = "vehicle_doors",
header = "Open Hood",
icon = "fas fa-car-burst",
action = function()
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
SetVehicleDoorOpen(vehicle, 4, false, false)
end
}
}
},
{
id = "vehicle_extras",
header = "Print Something",
text = "Just for testing",
icon = "fas fa-terminal",
color = "green",
action = function()
print("This is a custom Lua action!")
end
},
{
id = "vehicle_extras2",
header = "Vehicle Extras",
text = "Additional vehicle options",
icon = "fas fa-plus",
color = "green",
event = "moon-ui:vehicleExtras",
args = {"args1", "args2", "args3"} -- RegisterNetEvent("moon-ui:vehicleExtras", function(args1, args2, args3)
}
}, "Vehicle Management", "Control and customize your vehicle")
end)
-- Hackers Terminal Lock (check hackerterminalexamples.md for more)
RegisterCommand('testhacker', function()
local challenge = [[
Write a function that checks if a number is even or odd.
The function should:
- Take a single number parameter
- Return "even" for even numbers
- Return "odd" for odd numbers
- Handle negative numbers as well
Example:
isEvenOrOdd(4) should return "even"
isEvenOrOdd(3) should return "odd"
isEvenOrOdd(-2) should return "even"
isEvenOrOdd(-3) should return "odd"
]]
local testCases = {
{ input = {4}, expected = "even" },
{ input = {3}, expected = "odd" },
{ input = {-2}, expected = "even" },
{ input = {-3}, expected = "odd" }
}
-- Expected Response
--[[
return function(n)
if n % 2 == 0 then
return "even"
else
return "odd"
end
end
]]
exports['moon-ui']:OpenHackersTerminal(
'lua', -- language
challenge, -- challenge description
10, -- time limit in seconds (5 minutes)
testCases, -- test cases
function(success)
if success then
-- Handle successful hack
print('Hack successful!')
end
end,
function(message)
-- When time Is Up
print('Time Is Up')
end
)
end)
-- ProgressBar
RegisterCommand('testlockpick', function()
-- Progress bar with animation and prop
exports['moon-ui']:OpenProgressBar({
duration = 10000, -- 10 seconds
label = 'Picking Lock',
useWhileDead = false,
allowRagdoll = false,
style = 'minimal', -- radial / minimal / bar
canCancel = false,
disable = {
move = false,
car = true,
combat = true
},
anim = {
dict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
clip = 'machinic_loop_mechandplayer'
},
prop = {
model = 'prop_tool_screwdvr02',
bone = 57005,
pos = { x = 0.14, y = 0.0, z = -0.01 },
rot = { x = 0.0, y = 90.0, z = 0.0 }
}
}, function(success)
if success then
print('Lock picked successfully!')
else
print('Lock picking failed!')
end
end)
end)
-- Slider Lock
RegisterCommand('testsliders', function()
local sliders = {
{
id = "voltage",
label = "Power Supply Voltage",
target = 75, -- Target value (75%)
tolerance = 2 -- Must be within 2% of target
},
{
id = "frequency",
label = "Signal Frequency",
target = 45,
tolerance = 3
},
{
id = "amplitude",
label = "Wave Amplitude",
target = 60,
tolerance = 1
}
}
exports['moon-ui']:OpenSliderLock(sliders, 20, function(success)
if success then
print('Calibration successful!')
else
print('Calibration failed!')
end
end)
end)