kevin11 Posted May 2, 2010 Posted May 2, 2010 sorry for post flooding this is my final question /ban /kick etc how do i change it to !ban !kick
dzek (varez) Posted May 2, 2010 Posted May 2, 2010 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.
Aibo Posted May 2, 2010 Posted May 2, 2010 it is really stupid, i'm still wondering why people like old mIRC script commands 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.
kevin11 Posted May 2, 2010 Author Posted May 2, 2010 Access denied @ 'executeCommandHandler' - Line: 8 ? i added it in admin (acl) and still nothing
kevin11 Posted May 2, 2010 Author Posted May 2, 2010 i restarted and checked everything but didnt work
dzek (varez) Posted May 2, 2010 Posted May 2, 2010 first of all, you must STOP the server, then modify ACL, then start server..
kevin11 Posted May 2, 2010 Author Posted May 2, 2010 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
Callum Posted May 2, 2010 Posted May 2, 2010 Is your resource called exactly "commands!", or is the ! a typo?
robhol Posted May 2, 2010 Posted May 2, 2010 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.
kevin11 Posted May 2, 2010 Author Posted May 2, 2010 can someone call me a retard please i didnt add commands resource in resources lol im sorry for wasting your time (its working)
karlis Posted May 3, 2010 Posted May 3, 2010 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
Aibo Posted May 3, 2010 Posted May 3, 2010 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"?
karlis Posted May 3, 2010 Posted May 3, 2010 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
Aibo Posted May 3, 2010 Posted May 3, 2010 well then improve it, i never said it is perfect or anything. i said "something like".
karlis Posted May 3, 2010 Posted May 3, 2010 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)
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now