Angelo. Posted July 26, 2015 Share Posted July 26, 2015 (edited) Good day gents, So, I got this piece of code Client side: function bindKeyFunc(state) if(state == "bind")then local activeListString = "Page"..tostring(activeList) local ID1, NAME1, CONTENT1, COMMAND1 = dataRetrieve( activeListString, "Bind1") local ID2, NAME2, CONTENT2, COMMAND2 = dataRetrieve( activeListString, "Bind2") local ID3, NAME3, CONTENT3, COMMAND3 = dataRetrieve( activeListString, "Bind3") local ID4, NAME4, CONTENT4, COMMAND4 = dataRetrieve( activeListString, "Bind4") local ID5, NAME5, CONTENT5, COMMAND5 = dataRetrieve( activeListString, "Bind5") local ID6, NAME6, CONTENT6, COMMAND6 = dataRetrieve( activeListString, "Bind6") bindKey ( "1", "down", COMMAND1, CONTENT1 ) bindKey ( "2", "down", COMMAND2, CONTENT2 ) bindKey ( "3", "down", COMMAND3, CONTENT3 ) bindKey ( "4", "down", COMMAND4, CONTENT4 ) bindKey ( "5", "down", COMMAND5, CONTENT5 ) bindKey ( "6", "down", COMMAND6, CONTENT6 ) outputChatBox("All keys bounded!") elseif(state == "unbind")then res1 = unbindKey ( "1", "down", COMMAND1 ) res2 = unbindKey ( "2", "down", COMMAND2) res3 = unbindKey ( "3", "down", COMMAND3) res4 = unbindKey ( "4", "down", COMMAND4) res5 = unbindKey ( "5", "down", COMMAND5) res6 = unbindKey ( "6", "down", COMMAND6) -- outputs are for testing outputChatBox(tostring(res1)) outputChatBox(tostring(res2)) outputChatBox(tostring(res3)) outputChatBox(tostring(res4)) outputChatBox(tostring(res5)) outputChatBox(tostring(res6)) end end So the thing is, i'm using this function somewhere else with either "bind" or "unbind" as arguments ( string type arguments). There is no problem with the binding part, that works perfectly, but there is an issue with the unbindKey part because it returns false and the keys doesn't get unbinded. in case you're wondering, dataRetrieve() is a function made on the same script, and it works perfectly. No debug warnings/errors show. I'd like to know if anyone have experienced the same issue and how to fix it, thanks in advance Edited July 26, 2015 by Guest Link to comment
Arnold-1 Posted July 26, 2015 Share Posted July 26, 2015 I'm not sure about this one, but maybe you should put all the arguments of bindKey in unbindKey Link to comment
Angelo. Posted July 26, 2015 Author Share Posted July 26, 2015 https://wiki.multitheftauto.com/wiki/UnbindKey problem still up. Link to comment
Angelo. Posted July 26, 2015 Author Share Posted July 26, 2015 Never mind, after running some tests, I just realized how stupid my mistake was. Apparently I assigned the commands ( line 22 to line 27 ) as local, so the second block "elseif"(line 20) doesn't recognize the commands, so it doesn't gets unbinded. Silly me. Link to comment
Arnold-1 Posted July 26, 2015 Share Posted July 26, 2015 Lol no problem, it happens, alot. Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now