forked from Simnation/Main
ed
This commit is contained in:
parent
71d3cde454
commit
e9eae8307c
7 changed files with 0 additions and 0 deletions
36
resources/[carscripts]/lockpick/client.lua
Normal file
36
resources/[carscripts]/lockpick/client.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
local Promise = nil
|
||||
|
||||
RegisterNUICallback('close', function()
|
||||
SetNuiFocus(false, false)
|
||||
if Promise then
|
||||
Promise:resolve(false)
|
||||
end
|
||||
end)
|
||||
|
||||
RegisterNUICallback('succeed', function()
|
||||
SetNuiFocus(false, false)
|
||||
Promise:resolve(true)
|
||||
end)
|
||||
|
||||
RegisterNUICallback('failed', function()
|
||||
SetNuiFocus(false, false)
|
||||
Promise:resolve(false)
|
||||
end)
|
||||
|
||||
RegisterCommand('lockpicktry', function()
|
||||
local result = exports['lockpick']:startLockpick()
|
||||
print(result, 'lockpicking result')
|
||||
end)
|
||||
|
||||
exports('startLockpick', function(tries)
|
||||
SendNUIMessage({
|
||||
start = true,
|
||||
tries = tries
|
||||
})
|
||||
SetNuiFocus(true, true)
|
||||
|
||||
Promise = promise.new()
|
||||
|
||||
local result = Citizen.Await(Promise)
|
||||
return result
|
||||
end)
|
Loading…
Add table
Add a link
Reference in a new issue