diff --git a/src/map/script.cpp b/src/map/script.cpp index 0eed657684..328d534132 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -4785,6 +4785,11 @@ BUILDIN_FUNC(next) { TBL_PC* sd; + if (!st->mes_active) { + ShowWarning("buildin_next: There is no mes active.\n"); + return SCRIPT_CMD_FAILURE; + } + if( !script_rid2sd(sd) ) return SCRIPT_CMD_SUCCESS; #ifdef SECURE_NPCTIMEOUT @@ -4802,6 +4807,11 @@ BUILDIN_FUNC(clear) { TBL_PC* sd; + if (!st->mes_active) { + ShowWarning("buildin_clear: There is no mes active.\n"); + return SCRIPT_CMD_FAILURE; + } + if (!script_rid2sd(sd)) return SCRIPT_CMD_FAILURE; @@ -4821,9 +4831,9 @@ BUILDIN_FUNC(close) return SCRIPT_CMD_SUCCESS; if( !st->mes_active ) { - TBL_NPC* nd = map_id2nd(st->oid); st->state = END; // Keep backwards compatibility. - ShowWarning("Incorrect use of 'close' command! (source:%s / path:%s)\n",nd?nd->name:"Unknown",nd?nd->path:"Unknown"); + ShowWarning("Incorrect use of 'close' command!\n"); + script_reportsrc(st); } else { st->state = CLOSE; st->mes_active = 0;