diff options
author | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-04-07 15:14:35 +0000 |
---|---|---|
committer | celest <celest@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2005-04-07 15:14:35 +0000 |
commit | a6cd6538e4271ea08dc86803e8b7e8c8f235960b (patch) | |
tree | 883d4c1ae282fb67e1720f81c20f564499298ff4 /src/map/atcommand.c | |
parent | be2871f1e62bbb88c7fd413456d1b9c39d1f2fd9 (diff) | |
download | hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.tar.gz hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.tar.bz2 hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.tar.xz hercules-a6cd6538e4271ea08dc86803e8b7e8c8f235960b.zip |
* Readded @disablenpc
* Fixed @reloadscript not removing old NPC's and monsters first
* Some changes in mob and NPC unloading
* Changed the original @disablenpc to @hidenpc
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/branches/stable@1429 54d463be-8e91-2dee-dedb-b68131a5f0ec
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]) *------------------------------------------ |