Browse Source

viewpoint command update (#4143)

* Added the optional parameter 'char ID' to the command
Sader Fawall 6 years ago
parent
commit
a3fc44ef8a
2 changed files with 7 additions and 5 deletions
  1. 1 1
      doc/script_commands.txt
  2. 6 4
      src/map/script.cpp

+ 1 - 1
doc/script_commands.txt

@@ -7489,7 +7489,7 @@ rand(2,5) would result in 2,3,4 or 5
 
 
 ---------------------------------------
 ---------------------------------------
 
 
-*viewpoint <action>,<x>,<y>,<point number>,<color>;
+*viewpoint <action>,<x>,<y>,<point number>,<color>{,<Char ID>};
 
 
 This command will mark places on the mini map in the client connected to the
 This command will mark places on the mini map in the client connected to the
 invoking character. It uses the normal X and Y coordinates from the main map.
 invoking character. It uses the normal X and Y coordinates from the main map.

+ 6 - 4
src/map/script.cpp

@@ -6687,15 +6687,17 @@ BUILDIN_FUNC(viewpoint)
 	int type,x,y,id,color;
 	int type,x,y,id,color;
 	TBL_PC* sd;
 	TBL_PC* sd;
 
 
+	if (!script_charid2sd(7, sd)) {
+		st->state = END;
+		return SCRIPT_CMD_FAILURE;
+	}
+
 	type=script_getnum(st,2);
 	type=script_getnum(st,2);
 	x=script_getnum(st,3);
 	x=script_getnum(st,3);
 	y=script_getnum(st,4);
 	y=script_getnum(st,4);
 	id=script_getnum(st,5);
 	id=script_getnum(st,5);
 	color=script_getnum(st,6);
 	color=script_getnum(st,6);
 
 
-	if( !script_rid2sd(sd) )
-		return SCRIPT_CMD_SUCCESS;
-
 	clif_viewpoint(sd,st->oid,type,x,y,id,color);
 	clif_viewpoint(sd,st->oid,type,x,y,id,color);
 
 
 	return SCRIPT_CMD_SUCCESS;
 	return SCRIPT_CMD_SUCCESS;
@@ -24496,7 +24498,7 @@ struct script_function buildin_func[] = {
 	BUILDIN_DEF2(enableitemuse,"enable_items",""),
 	BUILDIN_DEF2(enableitemuse,"enable_items",""),
 	BUILDIN_DEF2(disableitemuse,"disable_items",""),
 	BUILDIN_DEF2(disableitemuse,"disable_items",""),
 	BUILDIN_DEF(cutin,"si"),
 	BUILDIN_DEF(cutin,"si"),
-	BUILDIN_DEF(viewpoint,"iiiii"),
+	BUILDIN_DEF(viewpoint,"iiiii?"),
 	BUILDIN_DEF(heal,"ii?"),
 	BUILDIN_DEF(heal,"ii?"),
 	BUILDIN_DEF(itemheal,"ii?"),
 	BUILDIN_DEF(itemheal,"ii?"),
 	BUILDIN_DEF(percentheal,"ii?"),
 	BUILDIN_DEF(percentheal,"ii?"),