summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorhemagx <hemagx2@gmail.com>2015-12-26 11:34:17 +0200
committerhemagx <hemagx2@gmail.com>2015-12-26 11:34:17 +0200
commit296e6c04a4c1a01a233c937bd198a31fa849f49c (patch)
tree897c0f790d406372de32145dcd4f2c1d12afd7b7 /src
parent44832129713a048f27ad4ae464fb88fe5beecfe0 (diff)
parentdabadbcff26890dc153ddc1602d0b1bf19009997 (diff)
downloadhercules-296e6c04a4c1a01a233c937bd198a31fa849f49c.tar.gz
hercules-296e6c04a4c1a01a233c937bd198a31fa849f49c.tar.bz2
hercules-296e6c04a4c1a01a233c937bd198a31fa849f49c.tar.xz
hercules-296e6c04a4c1a01a233c937bd198a31fa849f49c.zip
Merge pull request #1023 from Emistry/scriptcommand_setgroupid
Add *setgroupid script commands.
Diffstat (limited to 'src')
-rw-r--r--src/map/script.c25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/map/script.c b/src/map/script.c
index af790ccf5..b29794ec3 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -9068,6 +9068,30 @@ BUILDIN(getgmlevel)
return true;
}
+/// set the group ID of the player.
+/// setgroupid(<new group id>{,"<character name>"|<account id>})
+/// return 1 on success, 0 if failed.
+BUILDIN(setgroupid) {
+ struct map_session_data* sd = NULL;
+ int new_group = script_getnum(st, 2);
+
+ if (script_hasdata(st, 3)) {
+ if (script_isstringtype(st, 3))
+ sd = script->nick2sd(st, script_getstr(st, 3));
+ else
+ sd = script->id2sd(st, script_getnum(st, 3));
+ }
+ else
+ sd = script->rid2sd(st);
+
+ if (sd == NULL)
+ return true; // no player attached, report source
+
+ script_pushint(st, !pc->set_group(sd, new_group));
+
+ return true;
+}
+
/// Returns the group ID of the player.
///
/// getgroupid() -> <int>
@@ -20254,6 +20278,7 @@ void script_parse_builtin(void) {
BUILDIN_DEF(getgdskilllv,"iv"),
BUILDIN_DEF(basicskillcheck,""),
BUILDIN_DEF(getgmlevel,""),
+ BUILDIN_DEF(setgroupid, "i?"),
BUILDIN_DEF(getgroupid,""),
BUILDIN_DEF(end,""),
BUILDIN_DEF(checkoption,"i"),