Explorar o código

Modified script function 'donpcevent' as requested by Script Developer Euphy,
- now returns 1 when successful, 0 when fails.
- now shows a debug message on the console when no events are triggered.

git-svn-id: https://svn.code.sf.net/p/rathena/svn/trunk@16564 54d463be-8e91-2dee-dedb-b68131a5f0ec

shennetsind %!s(int64=12) %!d(string=hai) anos
pai
achega
33fb89ef91
Modificáronse 1 ficheiros con 6 adicións e 1 borrados
  1. 6 1
      src/map/script.c

+ 6 - 1
src/map/script.c

@@ -8601,7 +8601,12 @@ BUILDIN_FUNC(donpcevent)
 {
 	const char* event = script_getstr(st,2);
 	check_event(st, event);
-	npc_event_do(event);
+	if( !npc_event_do(event) ) {
+		struct npc_data * nd = map_id2nd(st->oid);
+		ShowDebug("NPCEvent '%s' not found! (source: %s)\n",event,nd?nd->name:"Unknown");
+		script_pushint(st, 0);
+	} else
+		script_pushint(st, 1);
 	return 0;
 }