This repository has been archived by the owner on Oct 19, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 20
/
EXAMPLE.txt
80 lines (73 loc) · 3.5 KB
/
EXAMPLE.txt
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
Example on adding more chains
In qb-core/shared/items.lua add this
[''] = {['name'] = '', ['label'] = '', ['weight'] = 1, ['type'] = 'item', ['image'] = '.png', ['unique'] = true, ['useable'] = true, ['shouldClose'] = true, ['combinable'] = nil, ['description'] = ''},
in qb-chains/client.lua add this
local wearing = false -- After wearing add a number to represent the chain make sure each chain has a different number (wearing32 is the next one)
CreateThread(function()
while true do
local sleep = 5000 -- If you want chain taken off quicker when item drop or removed change this number
if LocalPlayer.state.isLoggedIn then
QBCore.Functions.TriggerCallback('qb-chains:server:*event_name_here*', function(HasItem)
if not HasItem then
if wearing then
wearing = false
TriggerEvent('animations:client:EmoteCommandStart', {"adjusttie"})
QBCore.Functions.Progressbar("chain_misc", "Taking off chain..", 3000, false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
local ped = PlayerPedId()
SetPedComponentVariation(ped, 7, 0)
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end)
end
end
end)
end
Wait(sleep)
end
end)
RegisterNetEvent('chains:client:*event_name_here*', function(itemName)
if not wearing then
wearing = true
TriggerEvent('animations:client:EmoteCommandStart', {"adjusttie"})
QBCore.Functions.Progressbar("chain_misc", "Putting on chain..", 3000, false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
SetPedComponentVariation(ped, 7, 10, GetPedTextureVariation(ped, 7), 15) --- 7 is for neck accessories(teef) the 10 is for number chain and 15 is for number texture
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end)
elseif wearing then
wearing = false
TriggerEvent('animations:client:EmoteCommandStart', {"adjusttie"})
QBCore.Functions.Progressbar("chain_misc", "Taking off chain..", 3000, false, true, {
disableMovement = false,
disableCarMovement = false,
disableMouse = false,
disableCombat = true,
}, {}, {}, {}, function() -- Done
SetPedComponentVariation(ped, 7, 0)
TriggerEvent('animations:client:EmoteCommandStart', {"c"})
end)
end
end)
in qb-chains/server.lua add this
QBCore.Functions.CreateCallback('qb-chains:server:*event_name_here*', function(source, cb)
local Player = QBCore.Functions.GetPlayer(source)
local Item = Player.Functions.GetItemByName("*item_name_here*")
if Item ~= nil then
cb(true)
else
cb(false)
end
end)
QBCore.Functions.CreateUseableItem("*item_name_here*", function(source, item)
local src = source
local Player = QBCore.Functions.GetPlayer(src)
TriggerClientEvent("chains:client:*name_of_event_here*", src, item.name)
end)