forked from MT-Scripts/mt-clothingbag
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclient.lua
92 lines (81 loc) · 2.97 KB
/
client.lua
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
local QBCore = exports['qb-core']:GetCoreObject()
RegisterNetEvent('mt-clothingbag:client:openBag', function()
QBCore.Functions.Progressbar('name_here', 'PUTTING BAG ON FLOOR...', 2000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
animDict = 'random@domestic',
anim = 'pickup_low',
flags = 16,
}, {}, {}, function()
ClearPedTasks(PlayerPedId())
TriggerEvent('mt-clothingbag:client:spawnBag')
end)
end)
RegisterNetEvent('mt-clothingbag:client:spawnBag', function()
local playerPed = PlayerPedId()
local coords = GetEntityCoords(playerPed)
local forward = GetEntityForwardVector(playerPed)
local x, y, z = table.unpack(coords + forward * 1.0)
local model = `prop_big_bag_01`
RequestModel(model)
while (not HasModelLoaded(model)) do
Wait(1)
end
local obj = CreateObject(model, x, y, z, true, false, true)
PlaceObjectOnGroundProperly(obj)
SetEntityAsMissionEntity(obj)
Wait(500)
TriggerEvent('mt-clothingbag:client:openBag2', obj)
end)
RegisterNetEvent('mt-clothingbag:client:openBag2', function(obj)
QBCore.Functions.Progressbar('name_here', 'OPENING BAG...', 5000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
animDict = 'anim@amb@clubhouse@tutorial@bkr_tut_ig3@',
anim = 'machinic_loop_mechandplayer',
flags = 16,
}, {}, {}, function()
ClearPedTasks(PlayerPedId())
TriggerEvent('mt-clothingbag:client:progressDespawnBag', obj)
end)
end)
RegisterNetEvent('mt-clothing:client:openMenu', function()
TriggerEvent("rcore_clothes:openOutfits")
end)
RegisterNetEvent('mt-clothingbag:client:progressDespawnBag', function(obj)
QBCore.Functions.Progressbar('taking_cloth', 'TAKING CLOTHES FROM BAG...', 2000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
animDict = 'random@domestic',
anim = 'pickup_low',
flags = 16,
}, {}, {}, function()
Wait(500)
QBCore.Functions.Progressbar('picking_bag', 'PICKING UP BAG...', 2000, false, true, {
disableMovement = true,
disableCarMovement = true,
disableMouse = false,
disableCombat = true,
}, {
animDict = 'random@domestic',
anim = 'pickup_low',
flags = 16,
}, {}, {}, function()
TriggerEvent('mt-clothingbag:client:despawnBag', obj)
end)
end)
end)
RegisterNetEvent('mt-clothingbag:client:despawnBag', function(obj)
DeleteObject(obj)
TriggerServerEvent('mt-clothingbag:server:removeBag')
TriggerEvent('mt-clothing:client:openMenu')
end)