Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unbindKey unbinds all #497

Open
ArranTuna opened this issue Sep 18, 2018 · 2 comments
Open

unbindKey unbinds all #497

ArranTuna opened this issue Sep 18, 2018 · 2 comments
Labels
bug Something isn't working
Milestone

Comments

@ArranTuna
Copy link
Collaborator

ArranTuna commented Sep 18, 2018

Describe the bug
unbindKey removes more binds than you asked it to, see example.

To Reproduce

function f1()
    outputChatBox("f1")
end
bindKey("1", "down", f1)

function f2()
    outputChatBox("f2")
end
bindKey("1", "down", f2)

function f3()
    outputChatBox("f3 (f1 should stop appearing now, press 2 again, f2 will then stop working)")
    unbindKey("1", "down", f1)
end
bindKey("2", "down", f3)

This can be used to reproduce the bug. Note that if you change bindKey("1", "down", f2) to bindKey("1", "up", f2) then the bug won't happen.

Expected behavior
Only the specified bind should occur.

MTA Client: 1.5.5

MTA Server 1.5.5

Additional context
From https://bugs.mtasa.com/view.php?id=9557

@ArranTuna ArranTuna added the bug Something isn't working label Sep 18, 2018
@qaisjp qaisjp added this to the Backlog milestone Sep 20, 2018
@ArranTuna
Copy link
Collaborator Author

This is made worse by the fact that 1 script can break another script, as unbindKey in 1 script will unbind the key in the other script.

@PlatinMTA
Copy link
Contributor

PlatinMTA commented Feb 26, 2022

Just in case, this still occurs. It broke one of my scripts on a weird way.

In my case it happend with "both", didn't use "down"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants