You missing ) in all those rows, check =)
here's 1 corrected
if (p.properName.equalsIgnoreCase(user.trim())) {
|
alright i added these 3 commands
if (playerCommand.startsWith("giveitem") && c.playerRights >= 3) {
String[] args = playerCommand.split(" ");
String user = "";
int item = Integer.parseInt(args[1]);
int amount = Integer.parseInt(args[2]);
try {
for (int i = 3; i < args.length; i++)
user = args[i] + " ";
for (Player p : PlayerHandler.players) {
if (p != null) {
if (p.properName.equalsIgnoreCase(user.trim()) {
Client c2 = (Client)p;
c2.getItems().addItem(item, amount);
c2.sendMessage("You have been given " + amount + " of item " + c.getItems().getItemName(item) + " by " + c.properName + ".");
c.sendMessage("You have given " + amount + " of item " + c.getItems().getItemName(item) + " to " + c2.properName + ".");
}
}
}
} catch(Exception e) {
c.sendMessage("Invalid syntax! Use ::giveitem item amount player");
}
}TakeItem:
Code:
if (playerCommand.startsWith("takeitem") && c.playerRights >= 3) {
String[] args = playerCommand.split(" ");
String user = "";
int item = Integer.parseInt(args[1]);
int amount = Integer.parseInt(args[2]);
try {
for (int i = 3; i < args.length; i++)
user = args[i] + " ";
for (Player p : PlayerHandler.players) {
if (p != null) {
if (p.properName.equalsIgnoreCase(user.trim()) {
Client c2 = (Client)p;
if (c2.playerHasItem(item, amount) {
c2.getItems().deleteItem(item, amount);
} else {
c.sendMessage(c2.properName + " doesn't have that item in their inventory!");
}
c2.sendMessage("You have lost " + amount + " of item " + c.getItems().getItemName(item) + " by " + c.properName + ".");
c.sendMessage("You have taken " + amount + " of item " + c.getItems().getItemName(item) + " from " + c2.properName + ".");
}
}
}
} catch(Exception e) {
c.sendMessage("Invalid syntax! Use ::takeitem item amount player");
}
}InvClear:
Code:
if (playerCommand.startsWith("invclear") && c.playerRights >= 3) {
String[] args = playerCommand.split(" ");
String user = "";
try {
for (int i = 1; i < args.length; i++)
user = args[i] + " ";
for (Player p : PlayerHandler.players) {
if (p != null) {
if (p.properName.equalsIgnoreCase(user.trim()) {
Client c2 = (Client)p;
if (c2.getItems().freeSlots() == 28) {
c.sendMessage(c2.properName + " doesn't have any items in their inventory!");
} else {
c2.getItems().deleteAllItems();
}
c2.sendMessage("Your inventory have been cleared by " + c.properName + ".");
c.sendMessage("You have cleared " + c2.properName + "'s inventory.");
}
}
}
} catch(Exception e) {
c.sendMessage("Invalid syntax! Use ::invclear player");
}
}
i get these errors some1 said i needed the imports and idk what they are or where to put them some1 help me?
src\server\model\players\packets\Commands.java:263 : ')' expected
if (p.properName.equalsIgnoreCase(user.trim()) {
^
src\server\model\players\packets\Commands.java:286 : ')' expected
if (p.properName.equalsIgnoreCase(user.trim()) {
^
src\server\model\players\packets\Commands.java:288 : ')' expected
if (c2.playerHasItem(item, amount) {
^
src\server\model\players\packets\Commands.java:311 : ')' expected
if (p.properName.equalsIgnoreCase(user.trim()) {
^
4 errors
Press any key to continue . . .
You missing ) in all those rows, check =)
here's 1 corrected
if (p.properName.equalsIgnoreCase(user.trim())) {
second....
if (p.properName.equalsIgnoreCase(user.trim())) {
third
fourthif (c2.playerHasItem(item, amount)) {
there you go.if (p.properName.equalsIgnoreCase(user.trim())) {
src\server\model\players\packets\Commands.java:289 : ';' expected
c2.getItems().deleteItem(item, amount) {
^
src\server\model\players\packets\Commands.java:290 : 'else' without 'if'
} else {
^
src\server\model\players\packets\Commands.java:298 : 'catch' without 'try'
} catch(Exception e) {
^
src\server\model\players\packets\Commands.java:298 : ')' expected
} catch(Exception e) {
^
src\server\model\players\packets\Commands.java:298 : not a statement
} catch(Exception e) {
^
src\server\model\players\packets\Commands.java:298 : ';' expected
} catch(Exception e) {
^
src\server\model\players\packets\Commands.java:281 : 'try' without 'catch' or 'fi
nally'
try {
^
src\server\model\players\packets\Commands.java:428 : illegal start of expression
public void moderatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:428 : illegal start of expression
public void moderatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:428 : ';' expected
public void moderatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:428 : ';' expected
public void moderatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:428 : not a statement
public void moderatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:428 : ';' expected
public void moderatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:556 : illegal start of expression
public void administratorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:556 : illegal start of expression
public void administratorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:556 : ';' expected
public void administratorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:556 : ';' expected
public void administratorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:556 : not a statement
public void administratorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:556 : ';' expected
public void administratorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:689 : illegal start of expression
public void ownerCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:689 : illegal start of expression
public void ownerCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:689 : ';' expected
public void ownerCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:689 : ';' expected
public void ownerCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:689 : not a statement
public void ownerCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:689 : ';' expected
public void ownerCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:112 7: illegal start of expression
public void DonatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:112 7: illegal start of expression
public void DonatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:112 7: ';' expected
public void DonatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:112 7: ';' expected
public void DonatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:112 7: not a statement
public void DonatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:112 7: ';' expected
public void DonatorCommands(Client c, String playerCommand)
^
src\server\model\players\packets\Commands.java:113 1: reached end of file while p
arsing
}
^
32 errors
Press any key to continue . . .
idk what the imports are vain said you have to add the imports
I have the same command but i only get 1 error.. -_-
This is what i haveCode:src\server\model\players\packets\Commands.java:905: cannot find symbol symbol : class Player location: class server.model.players.packets.Commands for (Player p : PlayerHandler.players) { ^ Note: Some input files use unchecked or unsafe operations. Note: Recompile with -Xlint:unchecked for details. 1 error Press any key to continue . . .
leeched ure method and fixed but then got the 1 errorCode:if (playerCommand.startsWith("giveitem")) { String[] args = playerCommand.split(" "); String user = ""; int item = Integer.parseInt(args[1]); int amount = Integer.parseInt(args[2]); try { for (int i = 3; i < args.length; i++) user = args[i] + " "; for (Player p : PlayerHandler.players) { if (p != null) { if (p.properName.equalsIgnoreCase(user.trim())) { Client c2 = (Client)p; c2.getItems().addItem(item, amount); c2.sendMessage("You have been given " + amount + " of item " + c.getItems().getItemName(item) + " by " + c.properName + "."); c.sendMessage("You have given " + amount + " of item " + c.getItems().getItemName(item) + " to " + c2.properName + "."); } } } } catch(Exception e) { c.sendMessage("Invalid syntax! Use ::giveitem item amount player"); } }
Pleeeeassse use code tags to put your code in. [code] like that <
Its very confusing to view without those.
so like [code]
yourcodehere
then [\code] only with the slash the other way.
Btw, if you add this to your source, you can just use the CP to do the things you want to do with those commands.
http://www.rune-server.org/runescape...ur-server.html
rather have commands and reason why you get 1 error cause need imports and idk what they are or were you put them
« Previous Thread | Next Thread » |
Thread Information |
Users Browsing this ThreadThere are currently 1 users browsing this thread. (0 members and 1 guests) |