mirror of
https://github.com/CommunityOx/ox_lib.git
synced 2026-08-18 15:36: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)
|
||||||
@@ -17,7 +17,6 @@ const Indicator: React.FC<Props> = ({ angle, offset, multiplier, setSkillCheck }
|
|||||||
const isKeyPressed = useKeyPress('e');
|
const isKeyPressed = useKeyPress('e');
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
console.log(1);
|
|
||||||
intervalRef.current = setInterval(() => {
|
intervalRef.current = setInterval(() => {
|
||||||
setIndicatorAngle((prevState) => (prevState += multiplier));
|
setIndicatorAngle((prevState) => (prevState += multiplier));
|
||||||
}, 1);
|
}, 1);
|
||||||
|
|||||||
Reference in New Issue
Block a user