Thread: Piece of Code help?

Results 1 to 5 of 5
  1. #1 Piece of Code help? 
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    Sup guys.
    Well I am getting some errors from this piece of code I am putting in. I am just wondering, what is a better way to have this?

    Code:
    if (c.getItems().playerHasItem(14876, 1) || (14877, 1) || (14878, 1) || (14879, 1) || (14880, 1) || (14881, 1)) {
    		sendNpcChat1("You have an artifact that I lost, I'll give you a reward for that!", c.talkingNpc, "Aristarchus");
    In case you want to know what its being used for, its for an artifact reward system.
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Oct 2011
    Posts
    191
    Thanks given
    21
    Thanks received
    10
    Rep Power
    13
    Quote Originally Posted by z0mg_beast View Post
    Sup guys.
    Well I am getting some errors from this piece of code I am putting in. I am just wondering, what is a better way to have this?

    Code:
    if (c.getItems().playerHasItem(14876, 1) || (14877, 1) || (14878, 1) || (14879, 1) || (14880, 1) || (14881, 1)) {
    		sendNpcChat1("You have an artifact that I lost, I'll give you a reward for that!", c.talkingNpc, "Aristarchus");
    In case you want to know what its being used for, its for an artifact reward system.
    Code:
    if (c.getItems().playerHasItem(14876, 1) && c.getItems().playerHasItem(14877, 1) && c.getItems().playerHasItem(14878, 1) && c.getItems().playerHasItem(14879, 1)) {
                   sendNpcChat1("You have an artifact that I lost, I'll give you a reward for that!", c.talkingNpc, "Aristarchus");
    add in the missing one's from your code obviously, cba to do it for you
    Reply With Quote  
     

  3. #3  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    Thanks for trying but that wouldn't work. That is telling it that you would have to have all of them.
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Jan 2011
    Posts
    309
    Thanks given
    9
    Thanks received
    26
    Rep Power
    28
    You need to add:
    Code:
    c.getItems().playerHasItem
    In front of all of these.
    Code:
     
    || (14877, 1) || (14878, 1) || (14879, 1) || (14880, 1) || (14881, 1))
    Here
    Code:
    || c.getItems().playerHasItem(14877, 1) || c.getItems().playerHasItem(14878, 1) || c.getItems().playerHasItem(14879, 1) || c.getItems().playerHasItem(14880, 1) || c.getItems().playerHasItem(14881, 1))
    Or you could do this
    Code:
    public static int ITEMS[] = {ID1, ID2, ECT};
    Code:
    		for(int i = 0; i < ITEMS.length; i++) {
    			if(ITEMS[i] == ITEMS) {
    				sendMessage("YOU HAVE AN ITEM!");
    			}
    		}
    		return false;
    	}
    Reply With Quote  
     

  5. #5  
    Expect the Unexpected

    Acquittal's Avatar
    Join Date
    Jan 2011
    Age
    30
    Posts
    1,182
    Thanks given
    627
    Thanks received
    233
    Rep Power
    238
    Thanks, I fixed it!
    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. What does this piece of code do?
    By iHybrid in forum Help
    Replies: 1
    Last Post: 11-12-2010, 05:28 AM
  2. dont understand a piece of headicon code.
    By pk3r john in forum Help
    Replies: 1
    Last Post: 08-12-2010, 03:40 PM
  3. Load a piece if code from another file?
    By Runebay™ in forum Help
    Replies: 6
    Last Post: 05-05-2009, 02:16 AM
  4. Need a piece of code
    By wetee3 in forum Help
    Replies: 4
    Last Post: 03-27-2009, 06:34 PM
  5. Help with piece of code!
    By harraj128 in forum Help
    Replies: 12
    Last Post: 03-24-2009, 10:32 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
  •