Thread: pi help

Results 1 to 9 of 9
  1. #1 pi help 
    Registered Member g0d 0f war's Avatar
    Join Date
    Mar 2011
    Posts
    711
    Thanks given
    10
    Thanks received
    15
    Rep Power
    20
    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 . . .
    Reply With Quote  
     

  2. #2  
    Donator
    Ed17's Avatar
    Join Date
    Jun 2011
    Posts
    296
    Thanks given
    42
    Thanks received
    14
    Rep Power
    10
    You missing ) in all those rows, check =)
    here's 1 corrected
    if (p.properName.equalsIgnoreCase(user.trim())) {
    Reply With Quote  
     

  3. #3  
    Donator
    Ed17's Avatar
    Join Date
    Jun 2011
    Posts
    296
    Thanks given
    42
    Thanks received
    14
    Rep Power
    10
    second....
    if (p.properName.equalsIgnoreCase(user.trim())) {

    third
    if (c2.playerHasItem(item, amount)) {
    fourth
    if (p.properName.equalsIgnoreCase(user.trim())) {
    there you go.
    Reply With Quote  
     

  4. #4  
    Registered Member g0d 0f war's Avatar
    Join Date
    Mar 2011
    Posts
    711
    Thanks given
    10
    Thanks received
    15
    Rep Power
    20
    Quote Originally Posted by Ed17 View Post
    second....



    third


    fourth


    there you go.
    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
    Reply With Quote  
     

  5. #5  
    Banned
    Join Date
    Mar 2011
    Age
    29
    Posts
    97
    Thanks given
    35
    Thanks received
    5
    Rep Power
    0
    I have the same command but i only get 1 error.. -_-

    Code:
    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 . . .
    This is what i have

    Code:
    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");
    }
    }
    leeched ure method and fixed but then got the 1 error
    Reply With Quote  
     

  6. #6  
    #Winning

    Join Date
    Apr 2011
    Age
    28
    Posts
    2,245
    Thanks given
    367
    Thanks received
    388
    Rep Power
    1187
    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.


    Vouches
    Spoiler for Vouches:

    Quote Originally Posted by Exile rsps View Post
    Vouch thanks for that pic
    Quote Originally Posted by bwuk _im_pb View Post
    i vouch for charlie hes legit
    Quote Originally Posted by Pastaway
    Vouch for 'Charlie. Added a tut to my server I couldn't add and payed him after =]
    Quote Originally Posted by mongolias
    Vouch for 'Charlie. Sold me a banner, the trade went quick and efficiently.
    Quote Originally Posted by Lane
    Vouch for charlie, he is #1
    Quote Originally Posted by Raw Envy View Post
    Vouch for Charlie.
    Quote Originally Posted by -Null Code-
    Vouch Legit bought rs membership
    Quote Originally Posted by tucybro
    Traded with Charlie, went smoothly I went first and he paid promptly without and issues, great trader!



    Reply With Quote  
     

  7. #7  
    Banned
    Join Date
    Mar 2011
    Age
    29
    Posts
    97
    Thanks given
    35
    Thanks received
    5
    Rep Power
    0
    Quote Originally Posted by xCharliex View Post
    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.
    sorry my bad
    Reply With Quote  
     

  8. #8  
    #Winning

    Join Date
    Apr 2011
    Age
    28
    Posts
    2,245
    Thanks given
    367
    Thanks received
    388
    Rep Power
    1187
    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


    Vouches
    Spoiler for Vouches:

    Quote Originally Posted by Exile rsps View Post
    Vouch thanks for that pic
    Quote Originally Posted by bwuk _im_pb View Post
    i vouch for charlie hes legit
    Quote Originally Posted by Pastaway
    Vouch for 'Charlie. Added a tut to my server I couldn't add and payed him after =]
    Quote Originally Posted by mongolias
    Vouch for 'Charlie. Sold me a banner, the trade went quick and efficiently.
    Quote Originally Posted by Lane
    Vouch for charlie, he is #1
    Quote Originally Posted by Raw Envy View Post
    Vouch for Charlie.
    Quote Originally Posted by -Null Code-
    Vouch Legit bought rs membership
    Quote Originally Posted by tucybro
    Traded with Charlie, went smoothly I went first and he paid promptly without and issues, great trader!



    Reply With Quote  
     

  9. #9  
    Registered Member g0d 0f war's Avatar
    Join Date
    Mar 2011
    Posts
    711
    Thanks given
    10
    Thanks received
    15
    Rep Power
    20
    rather have commands and reason why you get 1 error cause need imports and idk what they are or were you put them
    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

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •