Posts: 2
Threads: 1
Joined: Dec 2012
Reputation:
0
04-03-2013, 03:45
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.
Posts: 74
Threads: 2
Joined: Mar 2013
Reputation:
6
04-03-2013, 13:04
(This post was last modified: 04-03-2013, 13:06 by X-Track.)
(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
Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
04-03-2013, 13:09
(This post was last modified: 04-03-2013, 13:16 by Nekochan.)
(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
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
Wouldn't MW3Console return the entire server content?
Posts: 3,704
Threads: 147
Joined: Jan 2011
Reputation:
119
(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
Posts: 2
Threads: 1
Joined: Dec 2012
Reputation:
0
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?
Posts: 285
Threads: 15
Joined: Nov 2011
Reputation:
12
04-04-2013, 11:31
(This post was last modified: 04-04-2013, 11:31 by archit.)
both parts of the card are for same assembly that is a class library
|