Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Ability to spam completed callback #14

Open
MichaelLoder opened this issue Apr 13, 2022 · 4 comments
Open

Ability to spam completed callback #14

MichaelLoder opened this issue Apr 13, 2022 · 4 comments

Comments

@MichaelLoder
Copy link

Changed code to
RegisterNUICallback('progress_minigame_input', function(data, cb)
if(not MiniGameCompleted) then
if OnComplete ~= nil then
OnComplete(data.success == true)
end
StopAnimation()
MiniGameCompleted = true
end
cb('ok')
end)

Mobius1 added a commit that referenced this issue Apr 18, 2022
@JohnnyS
Copy link

JohnnyS commented Jun 8, 2022

Doesnt resolve that you can hold SPACE and spam the event that is triggered afterwards multiple times. You can essential do the process of

minigame > hold space > get unlimited amounts of items if the code in success gives items

image

@Mobius1 Are you still refactoring this code or is it abandoned?

@JohnnyS
Copy link

JohnnyS commented Jun 8, 2022

image

@Ticko4
Copy link

Ticko4 commented Jun 11, 2022

You can fix this by changing the app.js file from line 190 to 212 to look like this
window.addEventListener("keydown", e => { if ( e.key == " " && keyIsDown == false) { if ( miniGame && running ) { keyIsDown = true; miniGame.pause(); PostData("progress_minigame_input", { success: miniGame.progress > miniGame.zoneMin && miniGame.progress < miniGame.zoneMax }) setTimeout(() => { miniGame.hide(); setTimeout(() => { running = false; miniGame.stop(); miniGame = false; keyIsDown = false; PostData("progress_minigame_complete"); }, 1000) }, 1000) } } });
and on top declare let keyIsDown = false
This will prevent the spamm, hope it helps

@JohnnyS
Copy link

JohnnyS commented Jun 12, 2022

That seems to have fixed it thank you very much

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants