-
Notifications
You must be signed in to change notification settings - Fork 0
/
client.lua
110 lines (100 loc) · 3.17 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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
local playerState = LocalPlayer.state
local config = require 'config'
local function setVisionSetting(type, boolean)
playerState[type] = boolean
if type == 'nightvision' then
SetNightvision(boolean)
elseif type == 'thermal' then
SetSeethrough(boolean)
end
if boolean then
--[[ Implement Native Audio for Goggles
exports.mana_audio:PlaySoundFromEntity({
audioBank = 'dlc_tempname/temp_name_sounds',
audioName = { 'audioName' },
audioRef = 'GetSoundsetName',
entity = PlayerPedId()
})
]]
config.Notify('Goggles', 'You have put on goggles!', 'success')
end
end
exports('nightvision', function()
if playerState.thermal then
return config.Notify('Thermal Goggles', "You're already wearing thermals!", "error")
end
if not playerState.nightvision then
if lib.progressCircle({
duration = 1000,
label = "Putting on NVGs..",
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = { combat = true, move = false },
anim = { dict = 'mp_masks@standard_car@ds@', clip = 'put_on_mask', flag = 16 }
}) then
setVisionSetting('nightvision', true)
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
SetPedComponentVariation(cache.ped, 1, 132, 0, 0)
elseif GetEntityModel(cache.ped) == `mp_f_freemode_01` then
SetPedComponentVariation(cache.ped, 1, 158, 0, 0)
end
else
config.Notify('Night Vision Goggles', "Cancelled..", "error")
end
else
if lib.progressCircle({
duration = 1000,
label = "Taking off NVGs..",
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = { combat = true, move = false },
anim = { dict = 'mp_masks@standard_car@ds@', clip = 'put_on_mask', flag = 16 }
}) then
setVisionSetting('nightvision', false)
SetPedComponentVariation(cache.ped, 1, 0, 0, 0)
else
config.Notify('Night Vision Goggles', "Cancelled..", "error")
end
end
end)
exports('thermalvision', function()
if playerState.nightvision then
return config.Notify('Night Vision Goggles', "You're already wearing NVGs!", "error")
end
if not playerState.thermal then
if lib.progressCircle({
duration = 1000,
label = "Putting on Thermal Goggles..",
position = 'bottom',
useWhileDead = false,
canCancel = true,
disable = { combat = true, move = false },
anim = { dict = 'mp_masks@standard_car@ds@', clip = 'put_on_mask', flag = 16 }
}) then
setVisionSetting('thermal', true)
if GetEntityModel(cache.ped) == `mp_m_freemode_01` then
SetPedComponentVariation(cache.ped, 1, 132, 0, 0)
elseif GetEntityModel(cache.ped) == `mp_f_freemode_01` then
SetPedComponentVariation(cache.ped, 1, 158, 0, 0)
end
else
config.Notify('Thermal Goggles', "Cancelled..", "error")
end
else
if lib.progressCircle({
duration = 1000,
label = "Taking off Thermal Goggles..",
position = 'bottom',
useWhileDead = false,
disable = { combat = true, move = false },
anim = { dict = 'mp_masks@standard_car@ds@', clip = 'put_on_mask', flag = 16 }
}) then
setVisionSetting('thermal', false)
SetPedComponentVariation(cache.ped, 1, 0, 0, 0)
else
config.Notify('Thermal Goggles', "Cancelled..", "error")
end
end
end)