Jump to content

addCommandHandler


Recommended Posts

Hi, I wrote this but it does not work. Where is the problem?

I want this function to follow a few commands

function Test()
outputChatBox("Ok")
 
end
addCommandHandler( {"Check""Checkk""checkkk"} )
 
Link to post

You can't use the addCommandHandler like that.
You can either do it like this (server side ONLY!):

addEventHandler("onPlayerCommand", root, function(cmd)
    if (cmd == "Check" or cmd == "Checkk" or cmd == "checkkk") then
    	outputChatBox("Okay")
    end
end)

or like this:

function testFunc()
	outputChatBox("Ok")
end
addCommandHandler( "Check", testFunc)
addCommandHandler( "Checkk", testFunc)
addCommandHandler( "checkkk", testFunc)

 

Edited by SpecT
Link to post

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...