Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Server TURN OFF plugin
#1
Question 
Help please.
Is there such a ready script or command:
I write in console server (not the game) command: "shutdown" or "off".
Server print on player HUD that round is last.
And when round is finished - turn off the server (close window with dedicated server) ?

Or if this is not complicated, can anyone make such a plugin?
I think many people would have such a script would be useful.
I do not want to hurt the players on and off the server in the middle of the round.

P.S. Sorry for my bad english please.
Reply

#2
(04-03-2013, 03:45)vudik Wrote: Help please.
Is there such a ready script or command:
I write in console server (not the game) command: "shutdown" or "off".
Server print on player HUD that round is last.
And when round is finished - turn off the server (close window with dedicated server) ?

Or if this is not complicated, can anyone make such a plugin?
I think many people would have such a script would be useful.
I do not want to hurt the players on and off the server in the middle of the round.

P.S. Sorry for my bad english please.

For in the game is it !rcon killserver
in the server console is it just: killserver

X-Track
Reply

#3
(04-03-2013, 13:04)X-Track Wrote:
(04-03-2013, 03:45)vudik Wrote: Help please.
Is there such a ready script or command:
I write in console server (not the game) command: "shutdown" or "off".
Server print on player HUD that round is last.
And when round is finished - turn off the server (close window with dedicated server) ?

Or if this is not complicated, can anyone make such a plugin?
I think many people would have such a script would be useful.
I do not want to hurt the players on and off the server in the middle of the round.

P.S. Sorry for my bad english please.

For in the game is it !rcon killserver
in the server console is it just: killserver

X-Track

Learn2read.

killserver closes server. He needs to warn players before closing, also write it in console.
I will add code. wait

Code:
unsafe string MW3Console
        {
            get
            {
                IntPtr form = FindWindow("IW5 WinConsole", "Call of Duty: Modern Warfare 3 Dedicated Server");
                IntPtr txtbox = FindWindowEx(form,IntPtr.Zero,"Edit",null);
                IntPtr console = FindWindowEx(form, txtbox, "Edit", null);
                StringBuilder sb = new StringBuilder(9999999);
                int result = SendMessageTimeout(
                  console,
                  0x0D /*WM_GETTEXT*/,
                  9999999,
                  sb,
                  10 /*SMTO_ABORTIFHUNG | SMTO_NOTIMEOUTIFNOTHUNG*/,
                  500,
                  IntPtr.Zero);
                return sb.ToString();
            }
        }

        [DllImport("user32.dll", EntryPoint = "FindWindow", CharSet = CharSet.Ansi)]
        public static extern IntPtr FindWindow(string className, string windowName);
        [DllImport("user32.dll", SetLastError = true, CharSet = CharSet.Auto)]
        public static extern IntPtr FindWindowEx(IntPtr parentHandle, IntPtr childAfter, string lclassName, string windowTitle);

        [DllImport("User32.dll", SetLastError = true)]
        public static extern int SendMessageTimeout(
          IntPtr hWnd,
          uint uMsg,
          uint wParam,
          StringBuilder lParam,
          uint fuFlags,
          uint uTimeout,
          IntPtr lpdwResult);

Then use "
Code:
if(MW3Console == "quitit")
{
foreach(ServerClient c in GetClients())
iprintlnbold(c, "Server will quit in some seconds");
// do wait, threading, stopwatch.... whatever
Environment.Quit(0);
}
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#4
Wouldn't MW3Console return the entire server content?
Reply

#5
(04-03-2013, 14:12)archit Wrote: Wouldn't MW3Console return the entire server content?

Uh, i forgot. But you can just skip \r\n and get last line.
C++/Obj-Cdeveloper. Neko engine wip
Steam: Click
Reply

#6
Thanks a lot for something that is not left unattended.
Even though I have minimal representation of what is done (write plugins for different server), but do not quite understand ...
From the first section of code I Compile an executable file, and the second section of the code I compile a class library?
Reply

#7
both parts of the card are for same assembly that is a class library
Reply



Possibly Related Threads…
Thread Author Replies Views Last Post
  [Release] Windows 8.1 Fix for MW3 Server Addon master131 16 18,165 09-29-2014, 23:08
Last Post: SuperNovaAO
Brick [Release] MW3 Server Administration Addon iRoNinja 5 9,002 11-10-2013, 15:46
Last Post: Casper
Exclamation Help cmdlist, dvarlist server crash Nerus 17 11,901 11-09-2013, 23:54
Last Post: Nerus
Wink Plugin with !ban !kick and !tampban clemi555 3 4,161 11-09-2013, 09:21
Last Post: clemi555
  AntiNoScope Plugin clemi555 5 4,739 11-08-2013, 19:13
Last Post: clemi555
  Our Level Fastfile is Different from the Server. CheeseToast 6 11,312 11-03-2013, 17:52
Last Post: CheeseToast
  Dedicated Server External (public) IP Nerus 3 5,895 11-02-2013, 14:16
Last Post: Casper
  [Release] Bunker Plugin 1.3 archit 68 41,463 10-30-2013, 11:59
Last Post: clacki
  MW3 Server Version superg1973 7 12,731 10-28-2013, 01:15
Last Post: kotyra972
  Help Modifying plugin maverigh 5 5,656 10-19-2013, 10:29
Last Post: Nekochan

Forum Jump:


Users browsing this thread:
1 Guest(s)

Forum Powered By MyBB, Theme by © 2002-2024 Melroy van den Berg.