Thread: [PI] Check if player is wearing a item

Results 1 to 6 of 6
  1. #1 [PI] Check if player is wearing a item 
    Middle Finger is Here


    Join Date
    Feb 2012
    Age
    31
    Posts
    2,546
    Thanks given
    377
    Thanks received
    502
    Rep Power
    162
    Need a check if player is wearing item

    example: ::hybrid command it will make character wear hybrid gear, but if player is currently wearing another item they can't do the command.

    ??? if you understood what i meant lol.

    rep++
    Hi
    Reply With Quote  
     

  2. #2  
    Owner of Dawntained

    Mgt Madness's Avatar
    Join Date
    Oct 2011
    Age
    28
    Posts
    3,380
    Thanks given
    1,429
    Thanks received
    958
    Rep Power
    2168
    for (int j = 0; j < player.playerEquipment.length; j++) {
    if (player.playerEquipment[j] > 0) {
    player.sendMessage("Please remove all your equipment before using this.");
    return;
    }
    }
    change player. to c.
    Attached image
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Nov 2013
    Posts
    126
    Thanks given
    5
    Thanks received
    21
    Rep Power
    42
    Quote Originally Posted by Braveyy View Post
    Need a check if player is wearing item

    example: ::hybrid command it will make character wear hybrid gear, but if player is currently wearing another item they can't do the command.

    ??? if you understood what i meant lol.

    rep++
    Code:
    for (int j = 0; j < c.getVariables().playerEquipment.length; j++) {
    					if (c.getVariables().playerEquipment[j] > 0) {
    						c.sendMessage("Take your items off before using this command.");
    						return;
    }
    }
    Reply With Quote  
     

  5. #4  
    Retired From RSPS

    iGarrett's Avatar
    Join Date
    Dec 2013
    Posts
    461
    Thanks given
    144
    Thanks received
    110
    Rep Power
    187
    Something like this..

    Code:
    public boolean checkEmpty(Client c) {
    			for(int i = 0; i < c.playerEquipment.length; i++) {
    				if(c.playerEquipment[i] != -1) {
    					return false;
    				}
    			}
    			return true;
    		} else {
    			return false;
    		}
    	}
    Reply With Quote  
     

  6. #5  
    Registered Member
    Join Date
    Nov 2013
    Posts
    126
    Thanks given
    5
    Thanks received
    21
    Rep Power
    42
    Quote Originally Posted by Weebly View Post
    Something like this..

    Code:
    public boolean checkEmpty(Client c) {
    			for(int i = 0; i < c.playerEquipment.length; i++) {
    				if(c.playerEquipment[i] != -1) {
    					return false;
    				}
    			}
    			return true;
    		} else {
    			return false;
    		}
    	}
    I thought I was bad for posting at the same time as someone else... Not alone 10minutes later.
    Reply With Quote  
     

  7. #6  
    Middle Finger is Here


    Join Date
    Feb 2012
    Age
    31
    Posts
    2,546
    Thanks given
    377
    Thanks received
    502
    Rep Power
    162
    Quote Originally Posted by Mgt Madness View Post
    change player. to c.
    Thanks, worked.
    Hi
    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. Replies: 7
    Last Post: 05-29-2013, 09:00 AM
  2. Replies: 14
    Last Post: 10-15-2012, 09:49 AM
  3. Replies: 7
    Last Post: 03-11-2011, 11:17 PM
  4. [PI] Check if player is wearing.
    By Treq in forum Help
    Replies: 1
    Last Post: 02-28-2011, 05:16 AM
  5. Replies: 5
    Last Post: 08-22-2010, 07:49 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
  •