-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathped_client.lua
More file actions
578 lines (498 loc) · 19.1 KB
/
ped_client.lua
File metadata and controls
578 lines (498 loc) · 19.1 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
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
local isPedMenuOpen = false
local peds = {
created = {},
marker = {},
selected = nil,
selectedElement = nil,
argumentStates = {},
argumentCheckBoxes = {},
animationArguments = { "Loop", "Update Position", "Interruptable", "Freeze Last Frame" },
weaponID = 0,
weaponsBySlot = {
[0] = { 0, 1 }, -- Hand
[1] = { 2, 3, 4, 5, 6, 7, 8, 9 }, -- Melee
[2] = { 22, 23, 24 }, -- Handguns
[3] = { 25, 26, 27 }, -- Shotguns
[4] = { 28, 29, 32 }, -- Sub-Machine Guns
[5] = { 30, 31 }, -- Assault Rifles
[6] = { 33, 34 }, -- Rifles
[7] = { 35, 36, 37, 38 }, -- Heavy Weapons
[8] = { 16, 17, 18, 39 }, -- Projectiles
[9] = { 41, 42, 43 }, -- Special 1
[10] = { 10, 11, 12, 14, 15 }, -- Gifts
[11] = { 44, 45, 46 }, -- Special 2
[12] = { 40 }, -- Satchel Detonator
},
}
function getCurrentPeds()
return peds.created
end
function getMarkersList()
return peds.marker
end
addEventHandler("onClientResourceStart", resourceRoot, function()
initializePedAnimatorGui()
triggerServerEvent("syncAnimations", localPlayer, animations)
triggerServerEvent("requestPedList", root)
triggerServerEvent("requestMarkerList", root)
addEventHandler("onClientGUIClick", pedAnimatorGrid, updatePedAnimation, false)
addEventHandler("onClientGUIClick", giveWeaponCheckBox, updatePedAnimation, false)
addEventHandler("onClientGUIClick", aimTargetCheckBox, updatePedAnimation, false)
addEventHandler("onClientGUIComboBoxAccepted", weaponComboBox, updatePedAnimation, false)
bindKey("F1", "down", function(key, state)
if getKeyState("lalt") then
pedAnimatorMainGuiToggle(key, state)
end
end)
addEvent("updatePedList", true)
addEventHandler("updatePedList", root, function(serverPeds)
guiGridListClear(pedGrid)
if guiGridListGetColumnCount(pedGrid) == 0 then
guiGridListAddColumn(pedGrid, "Select one of your peds", 1)
end
if not serverPeds or #serverPeds == 0 then
outputDebugString("[PAS] No peds received from server.")
return
end
peds.created = serverPeds
for i, pedData in ipairs(peds.created) do
if pedData.displayText then
local row = guiGridListAddRow(pedGrid)
guiGridListSetItemText(pedGrid, row, 1, pedData.displayText, false, false)
end
end
end)
addEvent("updateMarkersList", true)
addEventHandler("updateMarkersList", root, function(serverMarkers)
guiGridListClear(markerGrid)
if guiGridListGetColumnCount(markerGrid) == 0 then
guiGridListAddColumn(markerGrid, "Select one of your markers", 1)
end
if not serverMarkers or #serverMarkers == 0 then
outputDebugString("[PAS] No markers received from server.")
return
end
peds.marker = serverMarkers
for i, markerData in ipairs(peds.marker) do
if markerData.displayText then
local row = guiGridListAddRow(markerGrid)
guiGridListSetItemText(markerGrid, row, 1, markerData.displayText, false, false)
end
end
end)
addEvent("onReceivePedFileList", true)
addEventHandler("onReceivePedFileList", localPlayer, function(fileList)
if fileList then
for i, fileData in ipairs(fileList) do
local filePath = fileData.path
if filePath and filePath:match("%.json$") then
local fileName = filePath:match("([^/]+)%.json$")
local row = guiGridListAddRow(pedAnimatorSequenceGrid)
guiGridListSetItemText(pedAnimatorSequenceGrid, row, 1, fileName, false, false)
end
end
end
end)
addEvent("onClientElementSelect", true)
addEventHandler("onClientElementSelect", root, function()
setTimer(function()
peds.selectedElement = exports["editor_main"]:getSelectedElement()
if not isElement(peds.selectedElement) then
return
end
local selectedID = getElementID(peds.selectedElement)
if not selectedID then
return
end
for row = 0, guiGridListGetRowCount(pedGrid) - 1 do
local gridPedName = guiGridListGetItemText(pedGrid, row, 1)
for _, pedData in ipairs(peds.created) do
if pedData.displayText == gridPedName and pedData.id == selectedID then
guiGridListSetSelectedItem(pedGrid, row, 1)
updatePedAnimation()
return
end
end
end
end, 50, 1)
end)
addEvent("onClientElementDrop", true)
addEventHandler("onClientElementDrop", root, function()
if peds.selectedElement and getElementType(peds.selectedElement) == "ped" then
updatePedAnimation()
end
end)
addEvent("onPedSequenceLoadSuccess", true)
addEventHandler("onPedSequenceLoadSuccess", localPlayer, function(sequenceData, targetPed)
local frames = sequenceData.frames or sequenceData
if not frames or #frames == 0 then
return
end
if not isElement(targetPed) then
return
end
if playSequenceOnPed then
playSequenceOnPed(frames, targetPed)
end
end)
addEvent("onApplySequenceToPed", true)
addEventHandler("onApplySequenceToPed", root, function(sequenceData, targetPed)
local frames = sequenceData.frames or sequenceData
if not frames or #frames == 0 then
return
end
if not isElement(targetPed) then
return
end
if playSequenceOnPed then
playSequenceOnPed(frames, targetPed)
end
end)
end)
function initializePedAnimatorGui()
pedAnimatorWindow = guiCreateWindow(0.3, 0.2, 0.6, 0.6, "PAS - Ped Animator", true)
guiWindowSetSizable(pedAnimatorWindow, false)
guiSetVisible(pedAnimatorWindow, false)
pedAnimatorTabPanel = guiCreateTabPanel(0, 0.5, 0.25, 0.5, true, pedAnimatorWindow)
pedAnimatorTab = guiCreateTab("Animations", pedAnimatorTabPanel)
pedAnimatorSequencesTab = guiCreateTab("Animation Sequences", pedAnimatorTabPanel)
pedAnimatorGrid = guiCreateGridList(0, 0, 1, 1, true, pedAnimatorTab)
guiGridListAddColumn(pedAnimatorGrid, "Category", 0.5)
guiGridListAddColumn(pedAnimatorGrid, "Animation", 1)
pedAnimatorSequenceGrid = guiCreateGridList(0, 0, 1, 1, true, pedAnimatorSequencesTab)
guiGridListAddColumn(pedAnimatorSequenceGrid, "Sequence Name", 1)
addEventHandler("onClientGUIClick", pedAnimatorSequenceGrid, function()
updateSequenceAnimation()
end, false)
pedGrid = guiCreateGridList(0.27, 0.5, 0.22, 0.43, true, pedAnimatorWindow)
addEventHandler("onClientGUIClick", pedGrid, function()
local selectedPedRow = guiGridListGetSelectedItem(pedGrid)
if selectedPedRow and selectedPedRow ~= -1 then
local pedID = guiGridListGetItemText(pedGrid, selectedPedRow, 1)
for _, pedData in ipairs(peds.created) do
if pedData.displayText == pedID then
peds.selectedPed = getElementByID(pedData.id)
if isElement(peds.selectedPed) then
exports["editor_main"]:selectElement(peds.selectedPed)
-- Position camera to look at the ped
focusCameraOnPed(peds.selectedPed)
end
break
end
end
end
updatePedAnimation()
end, false)
for category, anims in pairs(animations) do
for _, anim in pairs(anims) do
local row = guiGridListAddRow(pedAnimatorGrid)
guiGridListSetItemText(pedAnimatorGrid, row, 1, category, false, false)
guiGridListSetItemText(pedAnimatorGrid, row, 2, anim, false, false)
end
end
local searchPedAnimationGrid = guiCreateEdit(0, 0.44, 0.125, 0.05, "Search Animation...", true, pedAnimatorWindow)
addEventHandler("onClientGUIChanged", searchPedAnimationGrid, function()
if guiGetText(searchPedAnimationGrid) == "Search Animation..." then
return
end
local searchText = string.lower(guiGetText(searchPedAnimationGrid))
guiGridListClear(pedAnimatorGrid)
for category, anims in pairs(animations) do
for _, anim in pairs(anims) do
if string.find(string.lower(anim), searchText, 1, true) then
local row = guiGridListAddRow(pedAnimatorGrid)
guiGridListSetItemText(pedAnimatorGrid, row, 1, category, false, false)
guiGridListSetItemText(pedAnimatorGrid, row, 2, anim, false, false)
end
end
end
end)
addEventHandler("onClientGUIFocus", searchPedAnimationGrid, function()
guiSetText(searchPedAnimationGrid, "")
guiSetInputMode("no_binds")
end, false)
addEventHandler("onClientGUIBlur", searchPedAnimationGrid, function()
if guiGetText(searchPedAnimationGrid) == "" then
guiSetText(searchPedAnimationGrid, "Search Animation...")
end
guiSetInputMode("allow_binds")
end, false)
local searchPedGrid = guiCreateEdit(0.27, 0.44, 0.1, 0.05, "Search Ped...", true, pedAnimatorWindow)
addEventHandler("onClientGUIChanged", searchPedGrid, function()
if guiGetText(searchPedGrid) == "Search Ped..." then
return
end
local searchText = string.lower(guiGetText(searchPedGrid))
guiGridListClear(pedGrid)
for i, pedData in ipairs(peds.created) do
if pedData.displayText and string.find(string.lower(pedData.displayText), searchText, 1, true) then
local row = guiGridListAddRow(pedGrid)
guiGridListSetItemText(pedGrid, row, 1, pedData.displayText, false, false)
end
end
end)
addEventHandler("onClientGUIClick", searchPedGrid, function()
guiSetText(searchPedGrid, "")
guiSetInputMode("no_binds")
end, false)
addEventHandler("onClientGUIBlur", searchPedGrid, function()
if guiGetText(searchPedGrid) == "" then
guiSetText(searchPedGrid, "Search Ped...")
end
guiSetInputMode("allow_binds")
end, false)
for i, arg in ipairs(peds.animationArguments) do
local y = 0.5 + (i - 1) * 0.03
local checkBox = guiCreateCheckBox(0.73, y, 0.2, 0.05, arg, false, true, pedAnimatorWindow)
peds.argumentCheckBoxes[arg] = checkBox
guiSetProperty(checkBox, "Selected", peds.argumentStates[arg] == true and "false" or "true")
addEventHandler("onClientGUIClick", checkBox, function()
peds.argumentStates[arg] = guiCheckBoxGetSelected(checkBox)
updatePedAnimation()
end, false)
if i >= #peds.animationArguments then
local weaponAmmoLabel = guiCreateLabel(0.73, y + 0.07, 0.1, 0.05, "Ammo", true, pedAnimatorWindow)
weaponAmmo = guiCreateEdit(0.73, y + 0.10, 0.2, 0.05, "1000", true, pedAnimatorWindow)
giveWeaponCheckBox =
guiCreateCheckBox(0.73, y + 0.15, 0.2, 0.05, "Give Weapon", false, true, pedAnimatorWindow)
weaponComboBox = guiCreateComboBox(0.73, y + 0.2, 0.2, 0.5, "Select Weapon", true, pedAnimatorWindow)
peds.argumentCheckBoxes["Ammo"] = weaponAmmo
peds.argumentCheckBoxes["Give Weapon"] = giveWeaponCheckBox
peds.argumentCheckBoxes["Weapon"] = weaponComboBox
for slot, weapons in pairs(peds.weaponsBySlot) do
for _, weaponID in ipairs(weapons) do
local weaponName = getWeaponNameFromID(weaponID)
guiComboBoxAddItem(weaponComboBox, weaponName)
end
end
local setPedAimTargetLabel =
guiCreateLabel(0.73, y + 0.25, 0.2, 0.05, "Set Ped Aim Target", true, pedAnimatorWindow)
aimTargetCheckBox = guiCreateCheckBox(0.73, y + 0.27, 0.2, 0.05, "Enable", false, true, pedAnimatorWindow)
aimTargetX = guiCreateEdit(0.73, y + 0.32, 0.05, 0.05, "X", true, pedAnimatorWindow)
aimTargetY = guiCreateEdit(0.82, y + 0.32, 0.05, 0.05, "Y", true, pedAnimatorWindow)
aimTargetZ = guiCreateEdit(0.91, y + 0.32, 0.05, 0.05, "Z", true, pedAnimatorWindow)
peds.argumentCheckBoxes["Set Aim Target"] = aimTargetCheckBox
peds.argumentCheckBoxes["Aim X"] = aimTargetX
peds.argumentCheckBoxes["Aim Y"] = aimTargetY
peds.argumentCheckBoxes["Aim Z"] = aimTargetZ
end
end
local applyAnimationButton = guiCreateButton(0.2675, 0.93, 0.11, 0.05, "Apply", true, pedAnimatorWindow)
addEventHandler("onClientGUIClick", applyAnimationButton, function()
local selectedAnimRow = guiGridListGetSelectedItem(pedAnimatorGrid)
local selectedPedRow = guiGridListGetSelectedItem(pedGrid)
if selectedAnimRow and selectedAnimRow ~= -1 and selectedPedRow and selectedPedRow ~= -1 then
local category = guiGridListGetItemText(pedAnimatorGrid, selectedAnimRow, 1)
local animName = guiGridListGetItemText(pedAnimatorGrid, selectedAnimRow, 2)
local pedID = guiGridListGetItemText(pedGrid, selectedPedRow, 1)
local isLoop = peds.argumentStates["Loop"] or false
local isUpdatePos = peds.argumentStates["Update Position"] or false
local isInterruptable = peds.argumentStates["Interruptable"] or false
local isFreezeLastFrame = peds.argumentStates["Freeze Last Frame"] or false
for i, pedData in ipairs(peds.created) do
if pedData.displayText == pedID then
local selectedPed = getElementByID(pedData.id)
if isElement(selectedPed) then
triggerServerEvent(
"applyPedAnimation",
localPlayer,
selectedPed,
category,
animName,
isLoop,
isUpdatePos,
isInterruptable,
isFreezeLastFrame
)
triggerServerEvent("onRequestDestroyPed", localPlayer, selectedPed)
end
break
end
end
end
end, false)
local applyAnimationSequenceButton =
guiCreateButton(0.38, 0.93, 0.11, 0.05, "Apply Sequence", true, pedAnimatorWindow)
addEventHandler("onClientGUIClick", applyAnimationSequenceButton, function()
local selectedSequenceRow = guiGridListGetSelectedItem(pedAnimatorSequenceGrid)
local selectedPedRow = guiGridListGetSelectedItem(pedGrid)
if selectedSequenceRow and selectedSequenceRow ~= -1 and selectedPedRow and selectedPedRow ~= -1 then
local sequenceName = guiGridListGetItemText(pedAnimatorSequenceGrid, selectedSequenceRow, 1)
local pedID = guiGridListGetItemText(pedGrid, selectedPedRow, 1)
local selectedMarkerRow = guiGridListGetSelectedItem(markerGrid)
local markerID = nil
if selectedMarkerRow and selectedMarkerRow ~= -1 then
local markerText = guiGridListGetItemText(markerGrid, selectedMarkerRow, 1)
for _, markerData in ipairs(peds.marker) do
if markerData.displayText == markerText then
markerID = markerData.id
break
end
end
end
for i, pedData in ipairs(peds.created) do
if pedData.displayText == pedID then
local selectedPed = getElementByID(pedData.id)
if isElement(selectedPed) then
if saveSequenceToAppliedAnimations(sequenceName, selectedPed, markerID) then
triggerServerEvent("onRequestDestroyPed", localPlayer, selectedPed)
end
end
break
end
end
else
outputChatBox(
"[PAS]#ffffff: Please select both a sequence and a ped to apply the sequence.",
0,
162,
137,
true
)
end
end, false)
markerGrid = guiCreateGridList(0.5, 0.5, 0.22, 0.43, true, pedAnimatorWindow)
local searchMarkerGrid = guiCreateEdit(0.5, 0.44, 0.1, 0.05, "Search Marker...", true, pedAnimatorWindow)
addEventHandler("onClientGUIChanged", searchMarkerGrid, function()
if guiGetText(searchMarkerGrid) == "Search Marker..." then
return
end
local searchText = string.lower(guiGetText(searchMarkerGrid))
guiGridListClear(markerGrid)
for i, markerData in ipairs(peds.marker) do
if markerData.displayText and string.find(string.lower(markerData.displayText), searchText, 1, true) then
local row = guiGridListAddRow(markerGrid)
guiGridListSetItemText(markerGrid, row, 1, markerData.displayText, false, false)
end
end
end)
addEventHandler("onClientGUIClick", searchMarkerGrid, function()
guiSetText(searchMarkerGrid, "")
guiSetInputMode("no_binds")
end, false)
addEventHandler("onClientGUIBlur", searchMarkerGrid, function()
if guiGetText(searchMarkerGrid) == "" then
guiSetText(searchMarkerGrid, "Search Marker...")
end
guiSetInputMode("allow_binds")
end, false)
local mainTabPanel = guiCreateTabPanel(0, 0.03, 1, 0.4, true, pedAnimatorWindow)
createKeyframeTab(mainTabPanel, pedAnimatorGrid, pedGrid, peds.argumentCheckBoxes)
createAnimationsTab(
mainTabPanel,
pedAnimatorGrid,
pedGrid,
markerGrid,
peds.marker,
applyAnimationButton,
peds.argumentCheckBoxes
)
end
function updatePedAnimation()
local selectedAnimationRow = guiGridListGetSelectedItem(pedAnimatorGrid)
local selectedPedRow = guiGridListGetSelectedItem(pedGrid)
local aimTargetEnabled = guiCheckBoxGetSelected(aimTargetCheckBox)
local isPedWeaponEnabled = guiCheckBoxGetSelected(giveWeaponCheckBox)
local weaponAmmo = guiGetText(weaponAmmo)
if guiComboBoxGetSelected(weaponComboBox) == -1 then
peds.weaponID = 0
else
local weaponName = guiComboBoxGetItemText(weaponComboBox, guiComboBoxGetSelected(weaponComboBox))
peds.weaponID = getWeaponIDFromName(weaponName)
end
if selectedPedRow and selectedPedRow ~= -1 then
local pedID = guiGridListGetItemText(pedGrid, selectedPedRow, 1)
for i, pedData in ipairs(peds.created) do
if pedData.displayText == pedID then
peds.selectedPed = getElementByID(pedData.id)
if isElement(peds.selectedPed) then
if isPedWeaponEnabled then
givePedWeapon(peds.selectedPed, peds.weaponID, weaponAmmo, true)
else
givePedWeapon(peds.selectedPed, 0, 0, true)
end
if aimTargetEnabled then
if not tonumber(aimTargetX) or not tonumber(aimTargetY) or not tonumber(aimTargetZ) then
aimTargetX, aimTargetY, aimTargetZ = 0, 0, 0
end
triggerServerEvent("stopPedAnimation", localPlayer, peds.selectedPed)
setPedAimTarget(
peds.selectedPed,
tonumber(aimTargetX),
tonumber(aimTargetY),
tonumber(aimTargetZ)
)
setPedControlState(peds.selectedPed, "fire", true)
else
setPedControlState(peds.selectedPed, "fire", false)
end
triggerServerEvent("stopPedAnimation", localPlayer, peds.selectedPed)
if selectedAnimationRow and selectedAnimationRow ~= -1 and not aimTargetEnabled then
local category = guiGridListGetItemText(pedAnimatorGrid, selectedAnimationRow, 1)
local animName = guiGridListGetItemText(pedAnimatorGrid, selectedAnimationRow, 2)
local isLoop = peds.argumentStates["Loop"] or false
local isUpdatePos = peds.argumentStates["Update Position"] or false
local isInterruptable = peds.argumentStates["Interruptable"] or false
local isFreezeLastFrame = peds.argumentStates["Freeze Last Frame"] or false
triggerServerEvent(
"applyPedAnimation",
localPlayer,
peds.selectedPed,
category,
animName,
isLoop,
isUpdatePos,
isInterruptable,
isFreezeLastFrame
)
end
else
outputDebugString("[PAS] No valid ped selected.")
end
break
end
end
end
end
function loadAndPlaySequence(sequenceName, ped)
if not sequenceName or not isElement(ped) then
outputChatBox("#FF0000ERROR#FFFFFF: Invalid sequence name or ped.", 255, 255, 255, true)
return
end
local filePath = "anim_sequences/" .. sequenceName .. ".json"
triggerServerEvent("onPedRequestSequenceLoad", localPlayer, filePath, ped)
end
function updateSequenceAnimation()
local selectedSequenceRow = guiGridListGetSelectedItem(pedAnimatorSequenceGrid)
local selectedPedRow = guiGridListGetSelectedItem(pedGrid)
if selectedSequenceRow and selectedSequenceRow ~= -1 and selectedPedRow and selectedPedRow ~= -1 then
local sequenceName = guiGridListGetItemText(pedAnimatorSequenceGrid, selectedSequenceRow, 1)
local pedID = guiGridListGetItemText(pedGrid, selectedPedRow, 1)
for i, pedData in ipairs(peds.created) do
if pedData.displayText == pedID then
local selectedPed = getElementByID(pedData.id)
if isElement(selectedPed) then
triggerServerEvent("stopPedAnimation", localPlayer, selectedPed)
loadAndPlaySequence(sequenceName, selectedPed)
end
break
end
end
end
end
function pedAnimatorMainGuiToggle(key, state)
if isMTAWindowActive() or guiGetInputMode() == "no_binds" then
return
end
if key and state then
if guiGetVisible(pedAnimatorWindow) then
guiSetVisible(pedAnimatorWindow, false)
showCursor(false)
isPedMenuOpen = false
else
guiSetVisible(pedAnimatorWindow, true)
showCursor(true)
isPedMenuOpen = true
end
end
end