Jump to content

Rewriting Default Commands


sirboring

Recommended Posts

Hy guys ,

I'm trying to make some really basic chat system as a way to learn the basics of lua / mta scripting.

I have something like this:

function chatMain(pl, cmd, ...) 
--shared logic
-- ...

if(cmd == "c") 
...
elseif(cmd == "me")
...
end
end

-- ...
addCommandHandler("c", chatMain)
addCommandHandler("s", chatMain)
addCommandHandler("me", chatMain)
addCommandHandler("do", chatMain)
addCommandHandler("b", chatMain)

Everything seems to be working just fine except /me 

It uses mta's default code rather than mine.

How can i change that ?

 

I tried with this

addEventHandler("onPlayerCommand", root, 
function(cmd) 
	if (cmd == "me") then 
		chatMain(source ,"me" ,...) 
	end 
end) 

but it's obviously wrong...

 

Thanks.

Edited by sirboring
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...