[Tut - A] [317] NPC command - Makes NPCs ingame, and saves to autospawn.cfg!

Results 1 to 6 of 6
  1. #1
    Enthusiast markkevin is offline
    MemberRank
    Jun 2006 Join Date
    46Posts

    [Tut - A] [317] NPC command - Makes NPCs ingame, and saves to autospawn.cfg!

    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.

    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");
                        }
                    }
    Credits: Me(markkevin) for doing it.
    Inside Sin because his runejava 3.0 gave me this idea.

    Thanks.


  2. #2
    Account Upgraded | Title Enabled! georgegeorge is offline
    MemberRank
    Oct 2005 Join Date
    Israel, Tel-AviLocation
    1,079Posts

    Re: Tired of hand-typing npcs to autospawn.cfg?Look this.

    Zamorak-Server v1 have same thing...

  3. #3
    Enthusiast markkevin is offline
    MemberRank
    Jun 2006 Join Date
    46Posts

    Re: Tired of hand-typing npcs to autospawn.cfg?Look this.

    Oo never used your servers :P

  4. #4
    Member owner abz is offline
    MemberRank
    Feb 2008 Join Date
    Under Your BedLocation
    69Posts

    Re: Tired of hand-typing npcs to autospawn.cfg?Look this.

    NiCe

  5. #5
    Enthusiast Sylesdelan36 is offline
    MemberRank
    Oct 2008 Join Date
    35Posts

    Re: [Tut] Tired of hand-typing npcs to autospawn.cfg?Look this.

    *DING* works thanks man!! really helped me out when i made my new ::home and ::train =P

  6. #6
    Proficient Member Tvirus06 is offline
    MemberRank
    Jul 2008 Join Date
    183Posts

    Re: [Tut] Tired of hand-typing npcs to autospawn.cfg?Look this.

    can you make this for 508? thanks..



Advertisement