CITMartin Posted August 13, 2017 Share Posted August 13, 2017 This function bindKey, unbindKey and isKeyBound have very errors when i use it with the option 2. bool bindKey ( player thePlayer, string key, string keyState, string commandName, [ string arguments ] ) Example script: PLS, SOMEONE OF DEVELOPER OF MTA CHECK THIS function addBindServer (player, commandName, theKey, theNewCommandToAddBind) local arguments = "1 2 3 4" local theEK = bindKey (player, theKey, "down", theNewCommandToAddBind, arguments) if theEK == true then outputChatBox("Bind created: true") else outputChatBox("Bind created: false") end if isKeyBound (player, theKey) then outputChatBox("isKeyBound: true") else outputChatBox("isKeyBound: false") end end addCommandHandler("addBind", addBindServer) function removeBindServer (player, commandName, theKey) local tableOfData = getFunctionsBoundToKey ( player , theKey ) outputChatBox ("Number of Functions to key "..theKey..": "..#tableOfData) for a, z in ipairs(tableOfData) do if unbindKey (player, theKey, "down", z) then outputChatBox("unbindKey: true") else outputChatBox("unbindKey: false") end end if unbindKey (player, theKey) then outputChatBox("true") else outputChatBox("false") end end addCommandHandler("removeBind", removeBindServer) function testingFunction (player, commandName, arg1, arg2, arg3, arg4) outputChatBox(arg1) outputChatBox(arg2) outputChatBox(arg3) outputChatBox(arg4) end addCommandHandler("testing", testingFunction) DATA RETURN Bind created: true isKeyBound: false Number of Functions to key m: 0 false Link to comment
MIKI785 Posted August 14, 2017 Share Posted August 14, 2017 There's nothing wrong with those functions, you're binding it to a command, not a function. Link to comment
CITMartin Posted August 15, 2017 Author Share Posted August 15, 2017 2 hours ago, MIKI785 said: There's nothing wrong with those functions, you're binding it to a command, not a function. if isKeyBound (player, theKey) then When i am creating the bind, isKeyBound must be equal to true, if this is false is wrong. the function unbindKey using a commandName as an argument is wrong. Pls some developer mta check this. Link to comment
Recommended Posts