Skip to content

Commit

Permalink
feat(client/skillcheck): winning/losing promise resolving
Browse files Browse the repository at this point in the history
  • Loading branch information
LukeWasTakenn committed Oct 18, 2022
1 parent 66c16b5 commit e4b3e01
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
19 changes: 19 additions & 0 deletions resource/interface/client/skillcheck.lua
Original file line number Diff line number Diff line change
@@ -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)
1 change: 0 additions & 1 deletion web/src/features/skillcheck/indicator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e4b3e01

Please sign in to comment.