-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathclient.lua
More file actions
84 lines (73 loc) · 2.25 KB
/
Copy pathclient.lua
File metadata and controls
84 lines (73 loc) · 2.25 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
local ESX = exports['es_extended']:getSharedObject()
local guiVisible = false
local fogSettings = {
intensity = Config.DefaultFog.intensity,
color = Config.DefaultFog.color
}
local function toggleGui()
guiVisible = not guiVisible
SetNuiFocus(guiVisible, guiVisible)
SendNUIMessage({
type = 'toggleGui',
visible = guiVisible
})
end
local function updateFog()
SetArtificialFogEnabled(true)
SetArtificialFogColor(fogSettings.color.r, fogSettings.color.g, fogSettings.color.b)
SetArtificialFogIntensity(fogSettings.intensity)
end
RegisterNUICallback('toggleFeature', function(data, cb)
TriggerServerEvent('FeatureToggleSystem:toggleFeature', data.feature, data.state)
cb({})
end)
RegisterNUICallback('setFog', function(data, cb)
fogSettings.intensity = data.intensity
fogSettings.color = data.color
updateFog()
TriggerServerEvent('FeatureToggleSystem:setFog', data.intensity, data.color)
cb({})
end)
RegisterNUICallback('minimizeGui', function(data, cb)
toggleGui()
cb({})
end)
RegisterCommand('togglefeatures', function()
toggleGui()
end, false)
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if guiVisible then
DisableControlAction(0, 1, true) -- LookLeftRight
DisableControlAction(0, 2, true) -- LookUpDown
DisableControlAction(0, 142, true) -- MeleeAttackAlternate
DisableControlAction(0, 106, true) -- VehicleMouseControlOverride
end
end
end)
RegisterNetEvent('FeatureToggleSystem:updateFeatures')
AddEventHandler('FeatureToggleSystem:updateFeatures', function(features)
SendNUIMessage({
type = 'updateFeatures',
features = features
})
end)
RegisterNetEvent('FeatureToggleSystem:updateFog')
AddEventHandler('FeatureToggleSystem:updateFog', function(intensity, color)
fogSettings.intensity = intensity
fogSettings.color = color
updateFog()
end)
Citizen.CreateThread(function()
while true do
Citizen.Wait(1000)
if guiVisible then
SendNUIMessage({
type = 'updatePlayerInfo',
playerName = GetPlayerName(PlayerId()),
playerId = GetPlayerServerId(PlayerId())
})
end
end
end)