diff options
Diffstat (limited to 'src/map/atcommand.c')
-rw-r--r-- | src/map/atcommand.c | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/src/map/atcommand.c b/src/map/atcommand.c index a420147bc..79e3ec675 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -167,6 +167,7 @@ ACMD_FUNC(guildrecall); // by Yor ACMD_FUNC(partyrecall); // by Yor ACMD_FUNC(nuke); // [Valaris] ACMD_FUNC(enablenpc); +ACMD_FUNC(hidenpc); ACMD_FUNC(disablenpc); ACMD_FUNC(servertime); // by Yor ACMD_FUNC(chardelitem); // by Yor @@ -433,6 +434,7 @@ static AtCommandInfo atcommand_info[] = { { AtCommand_PartyRecall, "@partyrecall", 60, atcommand_partyrecall }, // by Yor { AtCommand_Nuke, "@nuke", 60, atcommand_nuke }, // [Valaris] { AtCommand_Enablenpc, "@enablenpc", 80, atcommand_enablenpc }, // [] + { AtCommand_Hidenpc, "@hidenpc", 80, atcommand_hidenpc }, // [] { AtCommand_Disablenpc, "@disablenpc", 80, atcommand_disablenpc }, // [] { AtCommand_ServerTime, "@time", 0, atcommand_servertime }, // by Yor { AtCommand_ServerTime, "@date", 0, atcommand_servertime }, // by Yor @@ -5735,9 +5737,9 @@ int atcommand_reloadscript( rehash(); atcommand_broadcast( fd, sd, "@broadcast", "Reloading NPCs..." ); - do_init_npc(); + //do_init_npc(); do_init_script(); - + npc_reload(); npc_event_do_oninit(); clif_displaymessage(fd, msg_table[100]); // Scripts reloaded. @@ -6183,7 +6185,7 @@ int atcommand_enablenpc(const int fd, struct map_session_data* sd, * *------------------------------------------ */ -int atcommand_disablenpc(const int fd, struct map_session_data* sd, +int atcommand_hidenpc(const int fd, struct map_session_data* sd, const char* command, const char* message) { char NPCname[100]; @@ -6207,6 +6209,31 @@ int atcommand_disablenpc(const int fd, struct map_session_data* sd, return 0; } +int atcommand_disablenpc(const int fd, struct map_session_data* sd, + const char* command, const char* message) +{ + struct npc_data *nd; + char NPCname[100]; + nullpo_retr(-1, sd); + + memset(NPCname, '\0', sizeof(NPCname)); + + if (!message || !*message || sscanf(message, "%99[^\n]", NPCname) < 1) { + clif_displaymessage(fd, "Please, enter a NPC name (usage: @npcoff <NPC_name>)."); + return -1; + } + + if ((nd = npc_name2id(NPCname)) != NULL) { + npc_unload(nd); + clif_displaymessage(fd, msg_table[112]); // Npc Disabled. + } else { + clif_displaymessage(fd, msg_table[111]); // This NPC doesn't exist. + return -1; + } + + return 0; +} + /*========================================== * time in txt for time command (by [Yor]) *------------------------------------------ |