Jump to content

error with bindKey and unbindKey


CITMartin

Recommended Posts

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(tostring(theEK))
    else
        outputChatBox(tostring(theEK))
    end
end
addCommandHandler("addBind", addBindServer)

function addBindServer (player, commandName, theKey)
    local theEK = unbindKey (player, theKey)
    if theEK == true then
        outputChatBox(tostring(theEK))
    else
        outputChatBox(tostring(theEK))
    end
end
addCommandHandler("removeBind", addBindServer)

function testingFunction (player, commandName, arg1, arg2, arg3, arg4)
    outputChatBox(arg1)
    outputChatBox(arg2)
    outputChatBox(arg3)
    outputChatBox(arg4)
end
addCommandHandler("testing", testingFunction)

 

 

When i use in chatBox for example: /addBind m testing

I can add this bind with arguments, but, when i use unbindKey, the return value bool is nil. What is the problem?

 

Also, this type of bind is erase when i stop this script. How can stand my binds?

Link to comment
function addBindServer (player, commandName, theKey, theNewCommandToAddBind)
    local arguments = {1, 2, 3, 4}
    local theEK = bindKey (player, theKey, "down", theNewCommandToAddBind, unpack(arguments))
    if theEK == true then
        outputChatBox(tostring(theEK))
    else
        outputChatBox(tostring(theEK))
    end
end
addCommandHandler("addBind", addBindServer)

Try it like this.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...