-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcore.lua
More file actions
510 lines (489 loc) · 18.6 KB
/
Copy pathcore.lua
File metadata and controls
510 lines (489 loc) · 18.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
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
local displayclother = false
local cam = nil
local c_zoom = 2.8
local c_offset = -0.15
skinUser = {}
--[[ ONLY FOR REBOOT SCRIPT DEV
Citizen.CreateThread(function()
Wait(1500)
source = GetPlayerServerId(PlayerId())
exports.infinity_clothes:LoadOutfit(source)
end)
]]--
if Config.EnableCMDAll then
RegisterCommand("skineditor", function(source, args, rawCommand)
price = 0
DisplayActions(not displayclother, cloth_hash_names, price, 0)
camera(2.8, 0.4)
launchcreator = true
Light()
end, false)
end
RegisterNetEvent('infinity_clothes:OpenMenuOutfit')
AddEventHandler('infinity_clothes:OpenMenuOutfit', function(source, price, firstSpawn)
DisplayActions(not displayclother, cloth_hash_names, price, firstSpawn)
camera(2.8, 0.4)
launchcreator = true
Light()
end)
function DisplayActions(bool, cloth_hash_names, price, firstSpawn)
clothes = cloth_hash_names
if not IsPedMale(PlayerPedId()) then
sex = "female"
else
sex = "male"
end
displayclother = bool
SetNuiFocus(bool, bool)
SendNUIMessage({
type = "nui_content",
status = displayclother,
clothes = clothes,
sex = sex,
price = price,
firstSpawn = firstSpawn
})
end
RegisterNUICallback("exit", function(data)
DisplayActions(false)
launchcreator = false
destory()
end)
RegisterNUICallback("updateskin", function(data)
if data.removeclothe then
Citizen.InvokeNative(0xD710A5007C2AC539, PlayerPedId(), tonumber(data.removeclothe), 0)
removeClotheCat(data.removalcat)
end
if not data.removeclothe then
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(data.clothekey), false,true,true)
end
Citizen.InvokeNative(0x704C908E9C405136, PlayerPedId())
Citizen.InvokeNative(0xAAB86462966168CE, PlayerPedId(), 1)
Citizen.InvokeNative(0xCC8CA3E88256E58F, PlayerPedId(), 0, 1, 1, 1, 0)
if data.cat == "loadouts" then
loadouts = data.clothekey
elseif data.cat == "hats" then
hats = data.clothekey
elseif data.cat == "cloaks" then
cloaks = data.clothekey
elseif data.cat == "shirts_full" then
shirts_full = data.clothekey
elseif data.cat == "boot_accessories" then
boot_accessories = data.clothekey
elseif data.cat == "boots" then
boots = data.clothekey
elseif data.cat == "pants" then
pants = data.clothekey
elseif data.cat == "coats_closed" then
coats_closed = data.clothekey
elseif data.cat == "badges" then
badges = data.clothekey
elseif data.cat == "skirts" then
skirts = data.clothekey
elseif data.cat == "suspenders" then
suspenders = data.clothekey
elseif data.cat == "holsters_left" then
holsters_left = data.clothekey
elseif data.cat == "belt_buckles" then
belt_buckles = data.clothekey
elseif data.cat == "belts" then
belts = data.clothekey
elseif data.cat == "gunbelts" then
gunbelts = data.clothekey
elseif data.cat == "neckties" then
neckties = data.clothekey
elseif data.cat == "coats" then
coats = data.clothekey
elseif data.cat == "ponchos" then
ponchos = data.clothekey
elseif data.cat == "satchels" then
satchels = data.clothekey
elseif data.cat == "armor" then
armor = data.clothekey
elseif data.cat == "eyewear" then
eyewear = data.clothekey
elseif data.cat == "gloves" then
gloves = data.clothekey
elseif data.cat == "gauntlets" then
gauntlets = data.clothekey
elseif data.cat == "chaps" then
chaps = data.clothekey
elseif data.cat == "vests" then
vests = data.clothekey
elseif data.cat == "masks" then
masks = data.clothekey
elseif data.cat == "spats" then
spats = data.clothekey
elseif data.cat == "neckwear" then
neckwear = data.clothekey
elseif data.cat == "accessories" then
accessories = data.clothekey
elseif data.cat == "jewelry_bracelets" then
jewelry_bracelets = data.clothekey
end
end)
function removeClotheCat(catareremoved)
--print('cat removed', catareremoved)
if catareremoved == "loadouts" then
loadouts = nil
elseif catareremoved == "hats" then
hats = nil
elseif catareremoved == "cloaks" then
cloaks = nil
elseif catareremoved == "shirts_full" then
shirts_full = nil
elseif catareremoved == "boot_accessories" then
boot_accessories = nil
elseif catareremoved == "boots" then
boots = nil
elseif catareremoved == "pants" then
pants = nil
elseif catareremoved == "coats_closed" then
coats_closed = nil
elseif catareremoved == "badges" then
badges = nil
elseif catareremoved == "skirts" then
skirts = nil
elseif catareremoved == "suspenders" then
suspenders = nil
elseif catareremoved == "holsters_left" then
holsters_left = nil
elseif catareremoved == "belt_buckles" then
belt_buckles = nil
elseif catareremoved == "belts" then
belts = nil
elseif catareremoved == "gunbelts" then
gunbelts = nil
elseif catareremoved == "neckties" then
neckties = nil
elseif catareremoved == "coats" then
coats = nil
elseif catareremoved == "ponchos" then
ponchos = nil
elseif catareremoved == "satchels" then
satchels = nil
elseif catareremoved == "armor" then
armor = nil
elseif catareremoved == "eyewear" then
eyewear = nil
elseif catareremoved == "gloves" then
gloves = nil
elseif catareremoved == "gauntlets" then
gauntlets = nil
elseif catareremoved == "chaps" then
chaps = nil
elseif catareremoved == "vests" then
vests = nil
elseif catareremoved == "masks" then
masks = nil
elseif catareremoved == "spats" then
spats = nil
elseif catareremoved == "neckwear" then
neckwear = nil
elseif catareremoved == "accessories" then
accessories = nil
elseif catareremoved == "jewelry_bracelets" then
jewelry_bracelets = nil
end
end
RegisterNUICallback("saveclothes", function(data)
skinUser = {}
table.insert(skinUser,
{
loadouts = loadouts,
hats = hats,
cloaks = cloaks,
shirts_full = shirts_full,
boot_accessories = boot_accessories,
boots = boots,
pants = pants,
coats_closed = coats_closed,
badges = badges,
skirts = skirts,
suspenders = suspenders,
holsters_left = holsters_left,
belt_buckles = belt_buckles,
belts = belts,
gunbelts = gunbelts,
neckties = neckties,
coats = coats,
ponchos = ponchos,
satchels = satchels,
armor = armor,
eyewear = eyewear,
gloves = gloves,
gauntlets = gauntlets,
chaps = chaps,
vests = vests,
masks = masks,
spats = spats,
neckwear = neckwear,
accessories = accessories,
jewelry_bracelets = jewelry_bracelets
}
)
SkinJsonStorage = json.encode(skinUser)
source = GetPlayerServerId(PlayerId())
if tonumber(data.price) == 0 and firstSpawn ~= 1 then
exports.infinity_core:notification(source , 'Outfit Saved', 'Your clothes is now saved !', 'center_right', 'redm_min', 1600)
else
if tonumber(Config.Price) >= 1 then
exports.infinity_core:notification(source , 'Clothes Buyed', 'Your closes are now saved for '..Config.Price..'$', 'center_right', 'redm_min', 1600)
PlaySoundFrontend("PURCHASE", "Ledger_Sounds", true, 0)
else
exports.infinity_core:notification(source , 'Outfit Saved', 'Your clothes is now saved !', 'center_right', 'redm_min', 1600)
end
end
TriggerServerEvent('infinity_clothes:saveSkin', source, SkinJsonStorage, data.price)
end)
RegisterNetEvent('infinity_clothes:setOutfit')
AddEventHandler('infinity_clothes:setOutfit', function(OutfitPlayer)
if OutfitPlayer ~= nil then
for i, key in ipairs(OutfitPlayer) do
if key.loadouts then
loadouts = key.loadouts
end
if key.hats then
hats = key.hats
end
if key.cloaks then
cloaks = key.cloaks
end
if key.shirts_full then
shirts_full = key.shirts_full
end
if key.boot_accessories then
boot_accessories = key.boot_accessories
end
if key.boots then
boots = key.boots
end
if key.pants then
pants = key.pants
end
if key.hats then
hats = key.hats
end
if key.coats_closed then
coats_closed = key.coats_closed
end
if key.badges then
badges = key.badges
end
if key.skirts then
skirts = key.skirts
end
if key.suspenders then
suspenders = key.suspenders
end
if key.holsters_left then
holsters_left = key.holsters_left
end
if key.belt_buckles then
belt_buckles = key.belt_buckles
end
if key.belts then
belts = key.belts
end
if key.gunbelts then
gunbelts = key.gunbelts
end
if key.neckties then
neckties = key.neckties
end
if key.coats then
coats = key.coats
end
if key.ponchos then
ponchos = key.ponchos
end
if key.satchels then
satchels = key.satchels
end
if key.armor then
armor = key.armor
end
if key.eyewear then
eyewear = key.eyewear
end
if key.gloves then
gloves = key.gloves
end
if key.gauntlets then
gauntlets = key.gauntlets
end
if key.chaps then
chaps = key.chaps
end
if key.vests then
vests = key.vests
end
if key.masks then
masks = key.masks
end
if key.spats then
spats = key.spats
end
if key.neckwear then
neckwear = key.neckwear
end
if key.accessories then
accessories = key.accessories
end
if key.jewelry_bracelets then
jewelry_bracelets = key.jewelry_bracelets
end
end
skinUser = {}
table.insert(skinUser,
{
loadouts = loadouts,
hats = hats,
cloaks = cloaks,
shirts_full = shirts_full,
boot_accessories = boot_accessories,
boots = boots,
pants = pants,
coats_closed = coats_closed,
badges = badges,
skirts = skirts,
suspenders = suspenders,
holsters_left = holsters_left,
belt_buckles = belt_buckles,
belts = belts,
gunbelts = gunbelts,
neckties = neckties,
coats = coats,
ponchos = ponchos,
satchels = satchels,
armor = armor,
eyewear = eyewear,
gloves = gloves,
gauntlets = gauntlets,
chaps = chaps,
vests = vests,
masks = masks,
spats = spats,
neckwear = neckwear,
accessories = accessories,
jewelry_bracelets = jewelry_bracelets
}
)
SkinJsonStorage = json.encode(skinUser)
--print("[^4 [CLOTHES] Loading Player Outfit...]")
Wait(1500)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(loadouts), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(hats), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(cloaks), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(shirts_full), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(boot_accessories), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(boots), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(pants), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(coats_closed), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(badges), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(skirts), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(suspenders), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(holsters_left), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(belt_buckles), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(belts), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(gunbelts), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(neckties), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(coats), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(ponchos), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(satchels), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(armor), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(eyewear), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(gloves), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(gauntlets), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(chaps), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(vests), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(masks), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(spats), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(neckwear), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(accessories), false,true,true)
Citizen.InvokeNative(0xD3A7B003ED343FD9, PlayerPedId(), tonumber(jewelry_bracelets), false,true,true)
Citizen.InvokeNative(0x704C908E9C405136, PlayerPedId())
Citizen.InvokeNative(0xAAB86462966168CE, PlayerPedId(), 1)
Citizen.InvokeNative(0xCC8CA3E88256E58F, PlayerPedId(), 0, 1, 1, 1, 0)
end
end)
local headingss = -35.00
RegisterNUICallback('heading', function(data)
local playerPed = PlayerPedId()
headingss = headingss + data.value
SetEntityHeading(playerPed, headingss)
end)
RegisterNUICallback('defcam', function(data)
camera(2.8,-0.15)
c_zoom = 2.8
c_offset = -0.15
end)
RegisterNUICallback('camera', function(data)
if data.zoom ~= nil then
if c_zoom + data.zoom < 2.8 and c_zoom + data.zoom > 0.7 then
c_zoom = c_zoom + data.zoom
end
end
if data.offset ~= nil then
if c_offset + data.offset < 1.2 and c_offset + data.offset > -1.0 then
c_offset = c_offset + data.offset
end
end
camera(c_zoom ,c_offset)
end)
function Light()
while launchcreator do
Wait(1)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
DrawLightWithRange(coords.x+1 , coords.y+1 , coords.z + 1, 255, 255, 255, 5.0 ,10.0)
end
end
function destory()
SetCamActive(cam, false)
RenderScriptCams(false, true, 500, true, true)
DestroyAllCams(true)
cam = nil
end
function camera(zoom, offset)
DestroyAllCams(true)
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local heading = 45.0
local zoomOffset = zoom
local camOffset = offset
local angle = heading * math.pi / 180.0
local theta = {
x = math.cos(angle),
y = math.sin(angle)
}
local pos = {
x = coords.x + (zoomOffset * theta.x),
y = coords.y + (zoomOffset * theta.y)
}
local angleToLook = heading - 140.0
if angleToLook > 360 then
angleToLook = angleToLook - 360
elseif angleToLook < 0 then
angleToLook = angleToLook + 360
end
angleToLook = angleToLook * math.pi / 180.0
local thetaToLook = {
x = math.cos(angleToLook),
y = math.sin(angleToLook)
}
local posToLook = {
x = coords.x + (zoomOffset * thetaToLook.x),
y = coords.y + (zoomOffset * thetaToLook.y)
}
local add = (0.8*zoom)
SetEntityHeading(playerPed, headingss)
cam = CreateCamWithParams("DEFAULT_SCRIPTED_CAMERA", pos.x, pos.y, coords.z + camOffset, 300.00,0.00,0.00, 40.00, false, 0)
PointCamAtCoord(cam, posToLook.x-add, posToLook.y, coords.z + camOffset)
SetCamActive(cam, true)
RenderScriptCams(true, true, 500, true, true)
end
function LoadOutfit()
source = GetPlayerServerId(PlayerId())
TriggerServerEvent('infinity_clothes:getOutfit', source)
end