Thread: [pi] you cant spawn this item [pi] help?

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 [pi] you cant spawn this item [pi] help? 
    Registered Member pkinliyfe's Avatar
    Join Date
    May 2011
    Posts
    97
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    ok guys im making a spawn pk server and there is a pkp shop but i dont want people spawning the items in it ok so heres my ::item code


    Code:
      if (playerCommand.startsWith("item") && c.playerRights > 0) {
    				try {
    					String[] args = playerCommand.split(" ");
    					if (args.length == 3) {
    						int newItemID = Integer.parseInt(args[1]);
    						int newItemAmount = Integer.parseInt(args[2]);
    						if ((newItemID <= 20500) && (newItemID >= 0)) {
    							c.getItems().addItem(newItemID, newItemAmount);	
    							c.sendMessage("You can't spawn this item");	
    						} else {
    							c.sendMessage("That item ID does not exist.");
    						}
    
    					
    
    	
    					}
    				} catch(Exception e) {
    					
    				} // HERE?
    				} // HERE?
    }
    Reply With Quote  
     

  2. #2  
    Registered Member Googleİ's Avatar
    Join Date
    Apr 2011
    Posts
    217
    Thanks given
    2
    Thanks received
    12
    Rep Power
    1
    You allow them to spawn anything but still send the message 'You can't spawn this item'?

    if ((newItemID <= 20500) && (newItemID >= 0)) {
    c.getItems().addItem(newItemID, newItemAmount);
    c.sendMessage("You can't spawn this item");
    Reply With Quote  
     

  3. #3  
    Registered Member pkinliyfe's Avatar
    Join Date
    May 2011
    Posts
    97
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    i dont want them to spawn some items... i was trying differnt stuff
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  5. #5  
    Registered Member Googleİ's Avatar
    Join Date
    Apr 2011
    Posts
    217
    Thanks given
    2
    Thanks received
    12
    Rep Power
    1
    I'll just help you according to the title, because you're truly confusing me..

    Just add this in client.java

    Code:
    public int unspawnable[] = {####};
    
    public boolean isUnspawnable(int item) {
      for(int i = 0; i < unspawnable.length; i++) {
       if(unspawnable[i] == item)
        return true;
      }
     return false;
    }
    then add this in your command
    Code:
    if(c.isUnspawnable(newItemID)) {
    return;
    }
    Reply With Quote  
     

  6. #6  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,760
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    Quote Originally Posted by Googleİ View Post
    I'll just help you according to the title, because you're truly confusing me..

    Just add this in client.java

    Code:
    public int unspawnable[] = {####};
    
    public boolean isUnspawnable(int item) {
      for(int i = 0; i < unspawnable.length; i++) {
       if(unspawnable[i] == item)
        return true;
      }
     return false;
    }
    then add this in your command
    Code:
    if(c.isUnspawnable(newItemID)) {
    return;
    }
    i just posted the tutorial for that, read the posts before you post
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  7. #7  
    Registered Member Googleİ's Avatar
    Join Date
    Apr 2011
    Posts
    217
    Thanks given
    2
    Thanks received
    12
    Rep Power
    1
    Quote Originally Posted by spikeyyy View Post
    i just posted the tutorial for that, read the posts before you post
    I took like 20 seconds to post, and you posted that within that 20 seconds
    Reply With Quote  
     

  8. #8  
    Registered Member pkinliyfe's Avatar
    Join Date
    May 2011
    Posts
    97
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    My errors:

    Code:
    src\server\model\players\packets\Commands.java:44: cannot find symbol
    symbol  : method isUnspawnable(int)
    location: class server.model.players.Client
                                                            if(c.isUnspawnable(newIt
    emID)) {
                                                                ^
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.
    1 error
    Press any key to continue . . .
    Reply With Quote  
     

  9. #9  
    Registered Member pkinliyfe's Avatar
    Join Date
    May 2011
    Posts
    97
    Thanks given
    0
    Thanks received
    1
    Rep Power
    1
    bump
    Reply With Quote  
     

  10. #10  
    Registered Member Googleİ's Avatar
    Join Date
    Apr 2011
    Posts
    217
    Thanks given
    2
    Thanks received
    12
    Rep Power
    1
    Quote Originally Posted by pkinliyfe View Post
    bump
    added this?

    public boolean isUnspawnable(int item) {
    for(int i = 0; i < unspawnable.length; i++) {
    if(unspawnable[i] == item)
    return true;
    }
    return false;
    }
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. [pi] you cant spawn this item [pi]
    By pkinliyfe in forum Help
    Replies: 1
    Last Post: 08-27-2011, 11:39 AM
  2. 614 Item spawn noted
    By PvpAllDay in forum Help
    Replies: 2
    Last Post: 06-06-2011, 03:46 AM
  3. Item on Object Npc Spawn Help :)
    By Basak in forum Help
    Replies: 0
    Last Post: 05-07-2011, 09:14 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •