mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

bindKey shouldn't be able to bind function multiple times

Open ds1-e opened this issue 2 years ago • 0 comments

Describe the bug

If you gonna use bindKey twice, second call will return true and bind function even if it was bound before. I believe (and if i remember correctly, it was in past) that calling bindKey for the 2nd (and any other) time should return false, and do not attach function again.

Steps to reproduce

function testBindKey()
	print("Hi")
end
bindKey("j", "down", testBindKey)
bindKey("j", "down", testBindKey)

Press J once, "Hi" would be printed twice.

Version

Client/server: v1.5.9-release-21237

Additional context

Initially i thought that was causing function call to be blocked at all, but after all it just call function twice (or more).

Relevant log output

No response

Security Policy

  • [X] I have read and understood the Security Policy and this issue is not security related.

ds1-e avatar May 25 '22 00:05 ds1-e