-
Notifications
You must be signed in to change notification settings - Fork 117
Expand file tree
/
Copy pathclient.lua
More file actions
55 lines (45 loc) · 1.05 KB
/
client.lua
File metadata and controls
55 lines (45 loc) · 1.05 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
local Config = {
Style = 'default'
}
local properties = nil
AddEventHandler('onResourceStart', function(resourceName)
if GetCurrentResourceName() ~= resourceName then
return
end
Wait(1000)
SendNUIMessage({
action = 'SET_STYLE',
data = Config.Style
})
end)
RegisterNetEvent('QBCore:Client:OnPlayerLoaded', function()
SendNUIMessage({
action = 'SET_STYLE',
data = Config.Style
})
end)
RegisterNUICallback('buttonSubmit', function(data, cb)
SetNuiFocus(false)
properties:resolve(data.data)
properties = nil
cb('ok')
end)
RegisterNUICallback('closeMenu', function(_, cb)
SetNuiFocus(false)
properties:resolve(nil)
properties = nil
cb('ok')
end)
local function ShowInput(data)
Wait(150)
if not data then return end
if properties then return end
properties = promise.new()
SetNuiFocus(true, true)
SendNUIMessage({
action = 'OPEN_MENU',
data = data
})
return Citizen.Await(properties)
end
exports('ShowInput', ShowInput)