mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-17 15:06:02 +01:00
feat(client/skillcheck): winning/losing promise resolving
This commit is contained in:
19
resource/interface/client/skillcheck.lua
Normal file
19
resource/interface/client/skillcheck.lua
Normal file
@@ -0,0 +1,19 @@
|
||||
local skillcheck
|
||||
|
||||
function lib.skillCheck(difficulty)
|
||||
if skillcheck then return end
|
||||
skillcheck = promise:new()
|
||||
SetNuiFocus(true, false)
|
||||
SendNUIMessage({
|
||||
action = 'startSkillCheck',
|
||||
data = difficulty
|
||||
})
|
||||
return Citizen.Await(skillcheck)
|
||||
end
|
||||
|
||||
RegisterNUICallback('skillCheckOver', function(data, cb)
|
||||
cb(1)
|
||||
skillcheck:resolve(data.success)
|
||||
skillcheck = nil
|
||||
SetNuiFocus(false, false)
|
||||
end)
|
||||
Reference in New Issue
Block a user