Thread: npcreset command doesn't work?

Results 1 to 6 of 6
  1. #1 npcreset command doesn't work? 
    Registered Member Willixel+'s Avatar
    Join Date
    Oct 2012
    Age
    28
    Posts
    99
    Thanks given
    4
    Thanks received
    0
    Rep Power
    11
    Okay, so I made an ::npcreset command for my source, and I get no errors while compiling, but it doesn't work in-game. Here's the code for it;

    Code:
    if(playerCommand.equalsIgnoreCase("npcreset") && c.playerRights > 0){
                                    for (int i = 0; i < Server.npcHandler.maxNPCs; i++)
     
    {
                            if (Server.npcHandler.npcs[i] != null) {
    if(Server.npcHandler.npcs[i].npcType == 2745 || Server.npcHandler.npcs[i].npcType >= 3493 && Server.npcHandler.npcs[i].npcType <= 3496 || Server.npcHandler.npcs[i].npcType == 3491) {
                                    Server.npcHandler.npcs[i].isDead = false;
    }else
                                    Server.npcHandler.npcs[i].isDead = true;
                                    Server.npcHandler.npcs[i].actionTimer = 0;
                                    }
                            }
                    }
    Please help?
    Reply With Quote  
     

  2. #2  
    Registered Member
    Edd -'s Avatar
    Join Date
    Jul 2011
    Posts
    664
    Thanks given
    62
    Thanks received
    43
    Rep Power
    84
    Code:
    if(playerCommand.equalsIgnoreCase("npcreset") && c.playerRights > 0){
                                    for (int i = 0; i < Server.npcHandler.maxNPCs; i++) 
     
    {
                            if (Server.npcHandler.npcs[i] != null) {
                                    Server.npcHandler.npcs[i].isDead = true;
                                    Server.npcHandler.npcs[i].actionTimer = 0;
                                    }
                            }
                    }
    Reply With Quote  
     

  3. #3  
    Registered Member Willixel+'s Avatar
    Join Date
    Oct 2012
    Age
    28
    Posts
    99
    Thanks given
    4
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Edd is pro View Post
    Code:
    if(playerCommand.equalsIgnoreCase("npcreset") && c.playerRights > 0){
                                    for (int i = 0; i < Server.npcHandler.maxNPCs; i++) 
     
    {
                            if (Server.npcHandler.npcs[i] != null) {
                                    Server.npcHandler.npcs[i].isDead = true;
                                    Server.npcHandler.npcs[i].actionTimer = 0;
                                    }
                            }
                    }
    Nothing happens. *sigh*
    Reply With Quote  
     

  4. #4  
    Donator
    Wobblum's Avatar
    Join Date
    Dec 2011
    Posts
    238
    Thanks given
    11
    Thanks received
    11
    Rep Power
    11
    Quote Originally Posted by Motivade View Post
    Okay, so I made an ::npcreset command for my source, and I get no errors while compiling, but it doesn't work in-game. Here's the code for it;

    Code:
    if(playerCommand.equalsIgnoreCase("npcreset") && c.playerRights > 0){
                                    for (int i = 0; i < Server.npcHandler.maxNPCs; i++)
     
    {
                            if (Server.npcHandler.npcs[i] != null) {
    if(Server.npcHandler.npcs[i].npcType == 2745 || Server.npcHandler.npcs[i].npcType >= 3493 && Server.npcHandler.npcs[i].npcType <= 3496 || Server.npcHandler.npcs[i].npcType == 3491) {
                                    Server.npcHandler.npcs[i].isDead = false;
    }else
                                    Server.npcHandler.npcs[i].isDead = true;
                                    Server.npcHandler.npcs[i].actionTimer = 0;
                                    }
                            }
                    }
    Please help?
    Here is my command
    Code:
    if (playerCommand.startsWith("reloadspawns")) {
    				Server.npcHandler = null;
    				Server.npcHandler = new server.model.npcs.NPCHandler();
    				for (int j = 0; j < Server.playerHandler.players.length; j++) {
    					if (Server.playerHandler.players[j] != null) {
    						Client c2 = (Client)Server.playerHandler.players[j];
    						c2.sendMessage("<shad=15695415>[" + c.playerName + "] " + "Has Reloaded All Npc Spawns.</col>");
    Reply With Quote  
     

  5. #5  
    Registered Member Willixel+'s Avatar
    Join Date
    Oct 2012
    Age
    28
    Posts
    99
    Thanks given
    4
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by Starkzter View Post
    Here is my command
    Code:
    if (playerCommand.startsWith("reloadspawns")) {
    				Server.npcHandler = null;
    				Server.npcHandler = new server.model.npcs.NPCHandler();
    				for (int j = 0; j < Server.playerHandler.players.length; j++) {
    					if (Server.playerHandler.players[j] != null) {
    						Client c2 = (Client)Server.playerHandler.players[j];
    						c2.sendMessage("<shad=15695415>[" + c.playerName + "] " + "Has Reloaded All Npc Spawns.</col>");
    Still, nothing happens. Compiled with no errors, but nothing happens in-game. *sigh* I'm completely stuck on this.

    EDIT: You missed some brackets, but I inserted them when I tried the code, so no worries. I'm sure you could have guessed this when I said "compiled with no errors".
    Reply With Quote  
     

  6. #6  
    Registered Member Willixel+'s Avatar
    Join Date
    Oct 2012
    Age
    28
    Posts
    99
    Thanks given
    4
    Thanks received
    0
    Rep Power
    11
    Anyone else have solution to test out here? It won't even send the message via chatbox. *Le Sigh*
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)


User Tag List

Similar Threads

  1. my jail command work but unjail doesn't
    By angel sammie in forum Help
    Replies: 6
    Last Post: 06-14-2012, 02:12 PM
  2. [PI] Mute command doesn't work
    By Beanerrr in forum Help
    Replies: 13
    Last Post: 02-13-2011, 10:54 PM
  3. My tele command doesn't work why?
    By Rasmux in forum Help
    Replies: 4
    Last Post: 03-28-2009, 02:24 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •