/make player care

/make player care

Postby HETAL » 12 Jul 2013, 22:29

i found a funny one /make [player] care shows an invalid command
YOU HAVENT SEEN THE LAST OF ME ISMELLIKE
HETAL
 
Posts: 397
Joined: 24 May 2013, 12:10

Re: /make player care

Postby Conor » 13 Jul 2013, 00:37

It's because /care is not a real command. It is not in the Command.all list as a specific command (its own Command object). It is just directly coded into the method which is called on player chat. This (semi-pseudo)code is an example which might help you understand.

Code: Select all
// Called when a player chats
public void onPlayerChat(string message)
{
   if (message == "/care")
   {
       // They typed /care so do it directly here
       Player.SendMessage(this, "you're using /care");
   }
   else if(...other things...)
   {
        // Other things
   }
   else
   {
       // Use a real command
       Command.all.Find(message.Split(' ')[0].Substring(message.Split(' ')[0].IndexOf('/'))).Use(this, message.Split(' ')[1]);
   }
}
Conor (Conanza121)
User avatar
Conor
Coder
 
Posts: 390
Joined: 10 Oct 2012, 21:36
Location: @21Conor


Return to Closed Bugs

Who is online

Users browsing this forum: No registered users and 4 guests

cron