diff options
author | Jedzkie <jedzkie13@rocketmail.com> | 2020-06-23 08:00:00 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-06-23 08:00:00 +0800 |
commit | 520863eaeda83da14b88d09f6378cd8abd5a5174 (patch) | |
tree | 2496ea36744dc2f51d264741a78699e719ceeb3b /src/map/atcommand.c | |
parent | 0b7768837bed2aa521de5b9b76b2348943d7db20 (diff) | |
parent | 9b89425550094f51d633e5b5d6e86af65bffbf39 (diff) | |
download | hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.gz hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.bz2 hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.tar.xz hercules-520863eaeda83da14b88d09f6378cd8abd5a5174.zip |
Merge branch 'master' into jedzkie-pr03
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 3fe6c8581..76448b237 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -4499,6 +4499,7 @@ ACMD(loadnpc) // add to list of script sources and run it npc->addsrcfile(message); npc->parsesrcfile(message,true); + npc->motd = npc->name2id("HerculesMOTD"); npc->read_event_script(); clif->message(fd, msg_fd(fd,262)); @@ -4533,6 +4534,7 @@ ACMD(unloadnpc) npc->unload_duplicates(nd, (flag != 0)); npc->unload(nd, true, (flag != 0)); + npc->motd = npc->name2id("HerculesMOTD"); npc->read_event_script(); clif->message(fd, msg_fd(fd, 112)); /// Npc Disabled. return true; @@ -4588,6 +4590,7 @@ ACMD(reloadnpc) clif->message(fd, msg_fd(fd, 1386)); /// File unloaded. Be aware that... npc->addsrcfile(file_path); npc->parsesrcfile(file_path, true); + npc->motd = npc->name2id("HerculesMOTD"); npc->read_event_script(); clif->message(fd, msg_fd(fd, 262)); /// Script loaded. return true; @@ -8916,13 +8919,17 @@ ACMD(accinfo) /* [Ind] */ ACMD(set) { - char reg[SCRIPT_VARNAME_LENGTH+1], val[254]; + char reg[SCRIPT_VARNAME_LENGTH + 1]; + char val[SCRIPT_STRING_VAR_LENGTH + 1]; struct script_data* data; int toset = 0; bool is_str = false; size_t len; - if (!*message || (toset = sscanf(message, "%32s %253[^\n]", reg, val)) < 1) { + char format[20]; + safesnprintf(format, sizeof(format), "%%%ds %%%d[^\\n]", SCRIPT_VARNAME_LENGTH, SCRIPT_STRING_VAR_LENGTH); + + if (*message == '\0' || (toset = sscanf(message, format, reg, val)) < 1) { clif->message(fd, msg_fd(fd,1367)); // Usage: @set <variable name> <value> clif->message(fd, msg_fd(fd,1368)); // Usage: ex. "@set PoringCharVar 50" clif->message(fd, msg_fd(fd,1369)); // Usage: ex. "@set PoringCharVarSTR$ Super Duper String" |