Jump to content

Recommended Posts

Posted (edited)

Hi all,

I modified the old ServerMan and so that you can send commands to the console.

Download

Add new class to server-side:

public class CommandLine
    {
        public static void CmdInput()
        {
            while(true){
                string command = Console.ReadLine();
                if (command.Length > 0)
                {
                    if (command.Equals("notifyhello"))
                    {
                        NAPI.Notification.SendNotificationToAll("Hello!");
                      	NAPI.Util.ConsoleOutput("[INFO] You send notification 'Hello!' to all");
                    }
                    else
                    {
                        Console.WriteLine("ERROR: Command not found!");
                    }
                }
            }
        }
    }

 

And add into server-side ResourceStart event:

[ServerEvent(Event.ResourceStart)]
public void ResourceStart()
{
  Thread cmdLine = new Thread(new ThreadStart(CommandLine.CmdInput));
  cmdLine.Start();
}

spacer.png

nUKovnwC6QE.jpg

Edited by JackHunter

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