feat(client/skillcheck): winning/losing promise resolving

This commit is contained in:
Luke
2022-10-13 14:15:49 +02:00
committed by Luke
parent 66c16b5843
commit e4b3e0186d
2 changed files with 19 additions and 1 deletions

View 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)

View File

@@ -17,7 +17,6 @@ const Indicator: React.FC<Props> = ({ angle, offset, multiplier, setSkillCheck }
const isKeyPressed = useKeyPress('e');
useEffect(() => {
console.log(1);
intervalRef.current = setInterval(() => {
setIndicatorAngle((prevState) => (prevState += multiplier));
}, 1);