Well i was tired of writing npc **** into autospawn file so i made this.
It's replacement to ::npc command and it saves the npcs into /CFG/autospawn.cfg
Add the ::npc command or if you have it then just replace.
Credits: Me(markkevin) for doing it.Code:if (command.startsWith("npc") && playerRights >= 2 ) { try { int newNPC = Integer.parseInt(command.substring(4)); if (newNPC >= 0) { server.npcHandler.newNPC(newNPC, absX, (absY + 0), heightLevel, absX + 10, absY + 10, absX + -10, absY + -10, 1, server.npcHandler.GetNpcListHP(newNPC), false); sendMessage("You spawn an npc"); try { BufferedWriter bufferedwriter; bufferedwriter = null; bufferedwriter = new BufferedWriter(new FileWriter("./CFG/autospawn.cfg", true)); bufferedwriter.write((new StringBuilder()).append("spawn = ").append(newNPC).append(" ").append(absX).append(" ").append(absY).append(" ").append(heightLevel).append(" ").append(absX + 1).append(" ").append(absY + 1).append(" ").append(absX + -1).append(" ").append(absY + -1).append(" ").append("2").append(" ").append("NPC").toString()); bufferedwriter.newLine(); bufferedwriter.flush(); sendMessage("NPC Writing by markkevin - success"); } catch(Exception e) { sendMessage("NPC Writing by markkevin - failed"); } } else { sendMessage("No such NPC."); } } catch (Exception e) { sendMessage("Wrong Syntax! Use as ::npc 1"); } }
Inside Sin because his runejava 3.0 gave me this idea.
Thanks.



Reply With Quote![[Tut - A] [317] NPC command - Makes NPCs ingame, and saves to autospawn.cfg!](http://ragezone.com/hyper728.png)

