summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-08-10 19:44:15 +0300
committerAndrei Karas <akaras@inbox.ru>2016-08-10 19:44:15 +0300
commit5a06329b9d01b7c250e27843f0634b238aac90b7 (patch)
tree75c704416a4647b4b2e527598ab8262cfc0d9857
parent409da45527ce8b6ba82523d4f3ce1abaf4650906 (diff)
downloadevol-hercules-5a06329b9d01b7c250e27843f0634b238aac90b7.tar.gz
evol-hercules-5a06329b9d01b7c250e27843f0634b238aac90b7.tar.bz2
evol-hercules-5a06329b9d01b7c250e27843f0634b238aac90b7.tar.xz
evol-hercules-5a06329b9d01b7c250e27843f0634b238aac90b7.zip
Add console command serverexit.
It works in same way with gm command serverexit.
-rw-r--r--src/Makefile.am2
-rw-r--r--src/emap/console.c31
-rw-r--r--src/emap/console.h11
-rw-r--r--src/emap/init.c3
4 files changed, 47 insertions, 0 deletions
diff --git a/src/Makefile.am b/src/Makefile.am
index 9888bcf..7d164d8 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -40,6 +40,8 @@ MAP_SRC = emap/atcommand.c \
emap/clif.h \
emap/config.c \
emap/config.h \
+ emap/console.c \
+ emap/console.h \
emap/craft.c \
emap/craft.h \
emap/craftconf.c \
diff --git a/src/emap/console.c b/src/emap/console.c
new file mode 100644
index 0000000..80dbab3
--- /dev/null
+++ b/src/emap/console.c
@@ -0,0 +1,31 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#include "common/hercules.h"
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "common/HPMi.h"
+#include "common/memmgr.h"
+#include "common/socket.h"
+#include "map/map.h"
+
+#include "emap/console.h"
+#include "emap/inter.h"
+
+CPCMD(serverExit)
+{
+ int code = 0;
+ if (!line || !*line || sscanf(line, "%5d", &code) < 1)
+ {
+ ShowError("Wrong parameter\n");
+ return;
+ }
+
+ send_char_exit(code);
+
+ map->retval = code;
+ map->do_shutdown();
+}
diff --git a/src/emap/console.h b/src/emap/console.h
new file mode 100644
index 0000000..012b0af
--- /dev/null
+++ b/src/emap/console.h
@@ -0,0 +1,11 @@
+// Copyright (c) Copyright (c) Hercules Dev Team, licensed under GNU GPL.
+// Copyright (c) 2014 - 2015 Evol developers
+
+#ifndef EVOL_MAP_CONSOLE
+#define EVOL_MAP_CONSOLE
+
+#include "common/console.h"
+
+CPCMD(serverExit);
+
+#endif // EVOL_MAP_CONSOLE
diff --git a/src/emap/init.c b/src/emap/init.c
index cb14450..0082bd8 100644
--- a/src/emap/init.c
+++ b/src/emap/init.c
@@ -48,6 +48,7 @@
#include "emap/battleground.h"
#include "emap/clif.h"
#include "emap/config.h"
+#include "emap/console.h"
#include "emap/craft.h"
#include "emap/craftconf.h"
#include "emap/hashtable.h"
@@ -96,6 +97,8 @@ HPExport void plugin_init (void)
addAtcommand("mapexit", mapExit);
addAtcommand("serverexit", serverExit);
+ addCPCommand("serverexit", serverExit);
+
addScriptCommand("chatjoin", "i*", chatJoin);
addScriptCommand("setcamnpc", "*", setCamNpc);
addScriptCommand("setcam", "ii", setCam);