Jump to content

commands


Recommended Posts

Posted

you cant just change that one letter, to be recognized as commands..

you have to use "onPlayerChat" event, then check if his/her msg starts with "!" and after theres command you want to handle, then handle it.. (and cancell onPlayerChat event)

you will have to rewrite all addCommandHandler from all scripts..

for my opinion -> this is stupid.

Posted

it is really stupid, i'm still wondering why people like old mIRC script commands :D

anyway, you need only something like this:

addEventHandler("onPlayerChat", getRootElement(), 
function (text)
if string.sub(text, 1, 1) == "!" then
cancelEvent()
local command = string.gsub(gettok(text, 1, 32), "!", "")
local args = string.gsub(text, "!"..command, "")
--outputChatBox(getPlayerName(source)..": "..text, getRootElement())
executeCommandHandler(command, source, args)
end
end
)

if you want to display the command typed, uncomment the outputChatBox line.

Posted
first of all, you must STOP the server, then modify ACL, then start server..

ok this is what i did

stop server /shutdown in game

modified the acl

then i open the server and it shows the error

Posted

Having non-standard characters in resource names probably isn't a good idea anyways. Keep to alphanumerical and underscore (_), it should be enough and is definitely safe.

Posted

can someone call me a retard please

xD i didnt add commands resource in resources lol im sorry for wasting your time

(its working)

Posted

if you want to display the command typed, uncomment the outputChatBox line.

thats stupid, just don't cancel event then, besides your output is not fully functional

Posted

if you want to display the command typed, uncomment the outputChatBox line.

thats stupid, just don't cancel event then, besides your output is not fully functional

cancelling is done for a reason, you know.

if event is not cancelled, command will be executed BEFORE chat output, since it's called from chat event.

so if the command called prints something to the chat, IT will look stupid.

and exactly what do you mean "not fully functional"?

Posted

you said if you want to still show the command just uncoment

---

it isnt functional because it dont have nametag colored, and output at chat is not prevented from hex and eg. \n

Posted

i think this is completley fucntional, correct me if im wrong

outputChatBox(getPlayerName(source)..": #FFFFFF".."%q":format(text:gsub("#%x%x%x%x%x%x","")),getRootElement(),240,30,150,true)

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