Repository navigation
Expand file tree
/
Copy pathclient.lua
More file actions
60 lines (56 loc) · 1.92 KB
/
Copy pathclient.lua
File metadata and controls
60 lines (56 loc) · 1.92 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
local bag = nil
CreateThread(function()
lib.requestModel(`prop_money_bag_01`, 500)
end)
RegisterNetEvent('blindfold', function()
bag = CreateObject(`prop_money_bag_01`, 0, 0, 0, true, true, true)
while not DoesEntityExist(bag) do
Wait(0)
end
AttachEntityToEntity(bag, cache.ped, GetPedBoneIndex(cache.ped, 12844), 0.2, 0.04, 0, 0, 270.0, 60.0, true, true, false, true, 1, true)
SetNuiFocus(false, false)
SendNUIMessage({
action = "open"
})
end)
RegisterNetEvent('remove-blindfold', function()
DeleteEntity(bag)
SetEntityAsNoLongerNeeded(bag)
SendNUIMessage({type = 'closeAll'})
SendNUIMessage({action = "close"})
end)
exports.ox_target:addGlobalPlayer({
{
name = 'blindfold',
icon = 'fa-solid fa-car-side',
label = 'Blindfold',
canInteract = function(entity, distance, coords, name)
local count = exports.ox_inventory:Search('count', 'blindfold')
local id = GlobalState.blindfolds[GetPlayerServerId(NetworkGetPlayerIndexFromPed(entity))]
if id then
return false
end
if count >= 1 then
return true
end
end,
onSelect = function(data)
TriggerServerEvent('blindfold', GetPlayerServerId(NetworkGetPlayerIndexFromPed(data.entity)))
end
},
{
name = 'remove-blindfold',
icon = 'fa-solid fa-car-side',
label = "Remove blindfold",
canInteract = function(entity, distance, coords, name)
local id = GlobalState.blindfolds[GetPlayerServerId(NetworkGetPlayerIndexFromPed(entity))]
if id then
return true
end
return false
end,
onSelect = function(data)
TriggerServerEvent('remove-blindfold', GetPlayerServerId(NetworkGetPlayerIndexFromPed(data.entity)))
end
}
})