/sigh change command.startsWith to cmd.startsWith. Maybe if you read the code you might find the problem.
Make sure you have the appendToAutospawn2() in your server aswell.
|
Ok I have tried everything I can think of to get this command to work. No matter what I do I cannot fix it. So here comes your chance to fix it and be rewarded with rep+.
Some quick info about server. RichScape Based. Trying to edit a Delta command into command.java in Richscape v4 base.
Here is Starting code
Here is code with what I KNOW has to be changed.Code:if(command.startsWith("newnpc") && playerRights > 2){ try { int newNPC = Integer.parseInt(command.substring(7)); if (newNPC >= 0) { server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); } else { sM("No such NPC."); } } catch(Exception e) { sM("Wrong Syntax! Use as ::newnpc 1"); } int npcid = Integer.parseInt(command.substring(7)); int absx = absX; int absy = absY; appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); sM("Npc added."); sM("AbsX: "+absX+" AbsY: "+absY+""); }
I know a few other things that need to be changed but best leave it so Im not mistaken.Code:if(command.startsWith("newnpc") && playerRights > 2){ try { int newNPC = Integer.parseInt(command.substring(7)); if (newNPC >= 0) { server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); } else { Send("No such NPC."); } } catch(Exception e) { sM("Wrong Syntax! Use as ::newnpc 1"); } int npcid = Integer.parseInt(command.substring(7)); int absx = absX; int absy = absY; appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); Send("Npc added."); Send("AbsX: "+absX+" AbsY: "+absY+""); }
Here is a working sample code from the same Java file for referance.
If you still dont get what I am asking. I am trying to get the original code working on my server without any errors. If someone knows the fix please try to post the new code and/or post how I should fix it. Thanks in advance to the genious that can help.Code:if (c.Rights > 1) { if(cmd.equalsIgnoreCase("master")) { for(int i = 0; i < 24; i++) { c.addSkillXP(15000000, i); } } if (cmd.equalsIgnoreCase("pure")) { c.addSkillXP(15000000, 0); //attack c.addSkillXP(0, 1); //defense c.addSkillXP(15000000, 2); //strength c.addSkillXP(15000000, 3); //hitpoints c.addSkillXP(15000000, 4); //range c.addSkillXP(0, 5); //prayer c.addSkillXP(15000000, 6); //mage c.Send(""+ c.playerName +" is now a pure!"); }
/sigh change command.startsWith to cmd.startsWith. Maybe if you read the code you might find the problem.
Make sure you have the appendToAutospawn2() in your server aswell.
I have done both, and have it not working still. Thanks alot for the response though. I was just thinking, I dont think I had the AppendToAutospawn there once I figured out the cmd.startsWith
Let me try once more with both commands and try again.
Again thanks a bunch for response
---------- Post added at 11:54 PM ---------- Previous post was at 11:53 PM ----------
Just said that to get some help = )
I really keep getting dif compiler results so check this out and mabey recode what needs to be coded? Also mabey this is supposed to go into a designated section for command.java?
Anything I have coded wrong or need to delete or modify?Code:if (c.Rights > 1) { if(cmd.startsWith("newnpc")) { try { int newNPC = Integer.parseInt(command.substring(7)); if (newNPC >= 0) { server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); } else { Send("No such NPC."); } } catch(Exception e) { Send("Wrong Syntax! Use as ::newnpc 1"); } int npcid = Integer.parseInt(command.substring(7)); int absx = absX; int absy = absY; appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); Send("Npc added."); Send("AbsX: "+absX+" AbsY: "+absY+""); }
I can't help until you post the errors.
Here is my current error reading
Code:Locating Java please Wait .\Command.java:83: cannot find symbol symbol : variable command location: class Command int newNPC = Integer.parseInt(command.substring(7)); ^ .\Command.java:86: cannot find symbol symbol : variable absX location: class Command server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); ^ .\Command.java:86: cannot find symbol symbol : variable absY location: class Command server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); ^ .\Command.java:86: cannot find symbol symbol : variable heightLevel location: class Command server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); ^ .\Command.java:86: package server does not exist server.npcHandler.spawnANPC(newNPC, absX, absY, heightLevel); ^ .\Command.java:88: cannot find symbol symbol : method Send(java.lang.String) location: class Command Send("No such NPC."); ^ .\Command.java:91: cannot find symbol symbol : method Send(java.lang.String) location: class Command Send("Wrong Syntax! Use as ::newnpc 1"); ^ .\Command.java:93: cannot find symbol symbol : variable command location: class Command int npcid = Integer.parseInt(command.substring(7)); ^ .\Command.java:94: cannot find symbol symbol : variable absX location: class Command int absx = absX; ^ .\Command.java:95: cannot find symbol symbol : variable absY location: class Command int absy = absY; ^ .\Command.java:96: cannot find symbol symbol : variable absX location: class Command appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); ^ .\Command.java:96: cannot find symbol symbol : variable absY location: class Command appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); ^ .\Command.java:96: cannot find symbol symbol : variable absX location: class Command appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); ^ .\Command.java:96: cannot find symbol symbol : variable absY location: class Command appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); ^ .\Command.java:96: cannot find symbol symbol : method appendToAutoSpawn2(int,int,int,<nulltype>,<nulltype>,int,int) location: class Command appendToAutoSpawn2(npcid, absx, absy, absX + 2, absY + 2, absX - 2, absY - 2); ^ .\Command.java:97: cannot find symbol symbol : method Send(java.lang.String) location: class Command Send("Npc added."); ^ .\Command.java:98: cannot find symbol symbol : variable absX location: class Command Send("AbsX: "+absX+" AbsY: "+absY+""); ^ .\Command.java:98: cannot find symbol symbol : variable absY location: class Command Send("AbsX: "+absX+" AbsY: "+absY+""); ^ .\Command.java:98: cannot find symbol symbol : method Send(java.lang.String) location: class Command Send("AbsX: "+absX+" AbsY: "+absY+""); ^ 19 errors Finished Compiling Fatalx Please run server Alex we are all waiting here -.- Proatrix Loves you = ) All credits to Proatrix W00T Press any key to continue . . .
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |