Thread: Changing player rights to use command?

Results 1 to 7 of 7
  1. #1 Changing player rights to use command? 
    Banned
    Join Date
    Mar 2012
    Posts
    157
    Thanks given
    5
    Thanks received
    16
    Rep Power
    0
    How would I enable ::item for everyone?


    Code:
    			if (playerCommand.startsWith("item")) {
    				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);		
    						} else {
    							c.sendMessage("That item ID does not exist.");
    						}
    					} else {
    						c.sendMessage("Wrong usage: (Ex:(::pickup_ID_Amount)(::item 995 1))");
    					}
    				} catch(Exception e) {
    Reply With Quote  
     

  2. #2  
    GANGNAM STYLE!

    Ohad's Avatar
    Join Date
    Aug 2011
    Posts
    3,182
    Thanks given
    152
    Thanks received
    352
    Rep Power
    1671
    put it in the commands.java were the normal players commands are...
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Banned
    Join Date
    Mar 2012
    Posts
    157
    Thanks given
    5
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by Xtinctionx View Post
    put it in the commands.java were the normal players commands are...
    That is where its located. But its not enabled for everyone.
    Reply With Quote  
     

  5. #4  



    Join Date
    Oct 2011
    Posts
    875
    Thanks given
    301
    Thanks received
    373
    Rep Power
    338
    Use this instead, it meets your requirements.

    Code:
    
    if (playerCommand.startsWith("item")  && c.playerRights >= 0) {
    				if (c.inWild())
    					return;
    				try {
    				String[] args = playerCommand.split(" ");
    				int[] unspawnable = {995,};
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					int itemID = Integer.parseInt(args[1]);
    					for(int i : unspawnable) {
    						if(c.playerRights <= 2) {
    							if(itemID == i) {
    								c.sendMessage("You cannot spawn this item.");
    								return;
    							}
    						}
    					}
    					if ((newItemID <= 30000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						//System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
    						c.sendMessage("Spawned: " + newItemID + "");
    					} else {
    						c.sendMessage("That item ID does not exist.");
    					}
    				} else {
    					c.sendMessage("Wrong command or doesn't exist");
    				}
    				} catch (Exception e) {
    				
    				}
    			}
    Just stick it anywhere in your commands.java and it should work
    Reply With Quote  
     

  6. #5  
    Banned
    Join Date
    Mar 2012
    Posts
    157
    Thanks given
    5
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by Shawnbiotch View Post
    Use this instead, it meets your requirements.

    Code:
    
    if (playerCommand.startsWith("item")  && c.playerRights >= 0) {
    				if (c.inWild())
    					return;
    				try {
    				String[] args = playerCommand.split(" ");
    				int[] unspawnable = {995,};
    				if (args.length == 3) {
    					int newItemID = Integer.parseInt(args[1]);
    					int newItemAmount = Integer.parseInt(args[2]);
    					int itemID = Integer.parseInt(args[1]);
    					for(int i : unspawnable) {
    						if(c.playerRights <= 2) {
    							if(itemID == i) {
    								c.sendMessage("You cannot spawn this item.");
    								return;
    							}
    						}
    					}
    					if ((newItemID <= 30000) && (newItemID >= 0)) {
    						c.getItems().addItem(newItemID, newItemAmount);
    						//System.out.println("Spawned: " + newItemID + " by: " + c.playerName);
    						c.sendMessage("Spawned: " + newItemID + "");
    					} else {
    						c.sendMessage("That item ID does not exist.");
    					}
    				} else {
    					c.sendMessage("Wrong command or doesn't exist");
    				}
    				} catch (Exception e) {
    				
    				}
    			}
    Just stick it anywhere in your commands.java and it should work
    I'm not lieing to you, but it seriously doesn't work. And there were no errors.
    Reply With Quote  
     

  7. #6  
    Extreme Donator


    Join Date
    Oct 2006
    Posts
    1,370
    Thanks given
    64
    Thanks received
    197
    Rep Power
    426
    Tiggy, put the command outside of the if (c.playerRights >= 2) { statement.
    [Only registered and activated users can see links. ]


    Reply With Quote  
     

  8. #7  
    Banned
    Join Date
    Mar 2012
    Posts
    157
    Thanks given
    5
    Thanks received
    16
    Rep Power
    0
    Quote Originally Posted by phl0w View Post
    Tiggy, put the command outside of the if (c.playerRights >= 2) { statement.
    Thank you. The command was under public void owners.

    Fixed it by copying and pasting it above moderator commands.
    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. Changing The Default Player Rights?
    By Hidden Gamer in forum Help
    Replies: 3
    Last Post: 08-17-2011, 11:00 PM
  2. Replies: 8
    Last Post: 05-30-2010, 10:52 AM
  3. player rights command (REP ++)
    By sean00197 in forum Help
    Replies: 4
    Last Post: 01-31-2010, 06:34 AM
  4. 100 Errors when changing command rights..
    By pillowfight in forum Help
    Replies: 6
    Last Post: 07-20-2009, 11:26 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
  •