Jump to content

How make !command instead of /command?


Carbonik

Recommended Posts

Posted

You need to catch every chat message (onPlayerChat event) then make a string.match (more info | even more info) to check if first letter is a "!" and get the rest of the chat input (command and arguments). Hide message with cancelEvent and do your actions based of command and arguments extracted from chat message.

Also searching before asking is a good idea, because this was asked so many times already..

Also making command with exclamation mark at the beginning instead of slash is unnatural (from DOS times it's natural to pass arguments after slash!), uncommon (I think only 2-3 servers are using this.. Most players will just get confused) and just weird. And complicates the scripts.

  • 2 weeks later...
Posted

An example :

function(message,type) 
  if (string.find(message,"!me")) and not (string.find(message," !me")) then 
    setTimer(outputChatBox,50,1,"Im Here!",getRootElement(),255,0,0,true) 

Just learn :P

Posted

there is no need to bump this topic. author didn't respond - solved or no longer care. especially when he creates another topics.

your example is also wrong. i can type "blablabla!me is cool and da man" and it will work..

and wtf? why timer??? :o

  • Discord Moderators
Posted
for fun :P

actually you're not the only one who found that timer completely amusing

Guest
This topic is now closed to further replies.
  • Recently Browsing   0 members

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