Thread: [Ruse] Commands help

Page 1 of 2 12 LastLast
Results 1 to 10 of 15
  1. #1 [Ruse] Commands help 
    Registered Member
    Join Date
    Mar 2015
    Posts
    14
    Thanks given
    11
    Thanks received
    0
    Rep Power
    11
    I want to add a donator zone, which any donator can teleport too. However the problem i'm having at the moment is that, when I try to add new commands so that donators are able to teleport to the dzone. It doesn't work at all for the donators however it does work for staff members.

    Code:
    if (command[0].equals("dzone")) {
    			if (command.length > 1 && command[1].equals("all")) {
    				for (Player players : World.getPlayers()) {
    					if (players != null) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503, 0), TeleportType.NORMAL);
    						}
    					}
    				}
    			} else {
    				TeleportHandler.teleportPlayer(player, new Position(3094, 3503, 0), TeleportType.NORMAL);
    			}
    		}
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2014
    Posts
    8
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    Are you sure you have to ids set right or does your isMember = the same as your staff rights?
    Reply With Quote  
     

  3. #3  
    Extreme Donator

    Join Date
    Apr 2015
    Posts
    369
    Thanks given
    215
    Thanks received
    79
    Rep Power
    74
    players.getRights().isMember()
    post the isMember() method, but from what i remember its suppose to be something like
    player.getRights().BRONZE_MEMBER or something liek that, (Removed ruse from my eclipse, not re loading it in.)
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Mar 2015
    Posts
    14
    Thanks given
    11
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by durky View Post
    players.getRights().isMember()
    post the isMember() method, but from what i remember its suppose to be something like
    player.getRights().BRONZE_MEMBER or something liek that, (Removed ruse from my eclipse, not re loading it in.)
    Code:
    public enum PlayerRights {
    
    	/*
    	 * A regular member of the server.
    	 */
    	PLAYER(-1, null, 1, 1),
    	/*
    	 * A moderator who has more privilege than other regular members and donators.
    	 */
    	MODERATOR(-1, "<col=20B2AA><shad=0>", 1, 1),
    
    	/*
    	 * The second-highest-privileged member of the server.
    	 */
    	ADMINISTRATOR(-1, "<col=FFFF64><shad=0>", 1, 1),
    
    	/*
    	 * The highest-privileged member of the server
    	 */
    	OWNER(-1, "<col=B40404>", 1, 1),
    
    	/*
    	 * The Developer of the server, has same rights as the owner.
    	 */
    	DEVELOPER(-1, "<shad=B40404>", 1, 1),
    
    
    	/*
    	 * A member who has donated to the server. 
    	 */
    	BRONZE_MEMBER(60, "<shad=FF7F00>", 1.5, 1),
    	SILVER_MEMBER(40, "<shad=0><col=787878>", 1.5, 1.25),
     	GOLD_MEMBER(20, "<col=D9D919><shad=0>", 2, 1.5),
    	PLATINUM_MEMBER(10, "<shad=697998>", 2.5, 1.7),
    	DIAMOND_MEMBER(0, "<shad=0EBFE9>", 3, 2),
    	/*
    	 * A member who has the ability to help people better.
    	 */
    	SUPPORT(-1, "<col=FF0000><shad=0>", 1, 1),
    
    	/*
    	 * A member who has been with the server for a long time.
    	 */
    	VETERAN(30, "<col=CD661D>", 1, 1);
    
    	PlayerRights(int yellDelaySeconds, String yellHexColorPrefix, double loyaltyPointsGainModifier, double experienceGainModifier) {
    		this.yellDelay = yellDelaySeconds;
    		this.yellHexColorPrefix = yellHexColorPrefix;
    		this.loyaltyPointsGainModifier = loyaltyPointsGainModifier;
    		this.experienceGainModifier = experienceGainModifier;
    	}
    	
    	private static final ImmutableSet<PlayerRights> STAFF = Sets.immutableEnumSet(SUPPORT, MODERATOR, ADMINISTRATOR, OWNER, DEVELOPER);
    	private static final ImmutableSet<PlayerRights> MEMBERS = Sets.immutableEnumSet(BRONZE_MEMBER, SILVER_MEMBER, GOLD_MEMBER, PLATINUM_MEMBER, DIAMOND_MEMBER);
    	
    	/*
    	 * The yell delay for the rank
    	 * The amount of seconds the player with the specified rank must wait before sending another yell message.
    	 */
    	private int yellDelay;
    	private String yellHexColorPrefix;
    	private double loyaltyPointsGainModifier;
    	private double experienceGainModifier;
    	
    	public int getYellDelay() {
    		return yellDelay;
    	}
    	
    	/*
    	 * The player's yell message prefix.
    	 * Color and shadowing.
    	 */
    	
    	public String getYellPrefix() {
    		return yellHexColorPrefix;
    	}
    	
    	/**
    	 * The amount of loyalty points the rank gain per 4 seconds
    	 */
    	public double getLoyaltyPointsGainModifier() {
    		return loyaltyPointsGainModifier;
    	}
    	
    	public double getExperienceGainModifier() {
    		return experienceGainModifier;
    	}
    	
    	public boolean isStaff() {
    		return STAFF.contains(this);
    	}
    	
    	public boolean isMember() {
    		return MEMBERS.contains(this);
    	}
    	
    	/**
    	 * Gets the rank for a certain id.
    	 * 
    	 * @param id	The id (ordinal()) of the rank.
    	 * @return		rights.
    	 */
    	public static PlayerRights forId(int id) {
    		for (PlayerRights rights : PlayerRights.values()) {
    			if (rights.ordinal() == id) {
    				return rights;
    			}
    		}
    		return null;
    	}
    }
    I don't know where exactly the isMember() is located since i'm using notepad ++, so Im not sure if that is the correct code you are looking for.
    Reply With Quote  
     

  5. #5  
    Extreme Donator

    Join Date
    Apr 2015
    Posts
    369
    Thanks given
    215
    Thanks received
    79
    Rep Power
    74
    i found it
    so
    Code:
    	private static final ImmutableSet<PlayerRights> MEMBERS = Sets.immutableEnumSet(BRONZE_MEMBER, SILVER_MEMBER, GOLD_MEMBER, PLATINUM_MEMBER, DIAMOND_MEMBER);
    This should work.
    put it under
    Code:
     private static void memberCommands
    Code:
    	if (command[0].equals("dzone")) {
    			if (command.length > 1 && command[1].equals("all")) {
    				for (Player players : World.getPlayers()) {
    					if (players != null) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    						}
    					}
    				}
    			}
    		}
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Mar 2015
    Posts
    14
    Thanks given
    11
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by durky View Post
    i found it
    so
    Code:
    	private static final ImmutableSet<PlayerRights> MEMBERS = Sets.immutableEnumSet(BRONZE_MEMBER, SILVER_MEMBER, GOLD_MEMBER, PLATINUM_MEMBER, DIAMOND_MEMBER);
    This should work.
    put it under
    Code:
     private static void memberCommands
    Code:
    	if (command[0].equals("dzone")) {
    			if (command.length > 1 && command[1].equals("all")) {
    				for (Player players : World.getPlayers()) {
    					if (players != null) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    						}
    					}
    				}
    			}
    		}
    I have added
    Code:
    if (command[0].equals("dzone")) {
    			if (command.length > 1 && command[1].equals("all")) {
    				for (Player players : World.getPlayers()) {
    					if (players != null) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    						}
    					}
    				}
    			}
    		}
    I have put it under the membercommands section however it still doesn't work for any donator ranks.
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Apr 2014
    Posts
    232
    Thanks given
    34
    Thanks received
    49
    Rep Power
    14
    This is not how u do it, + if the user who wishes to teleport to the donatorzone, he can teleport all members to the donatorzone aswell, you took that from an other staff command i believe so
    Reply With Quote  
     

  8. #8  
    Extreme Donator

    Join Date
    Apr 2015
    Posts
    369
    Thanks given
    215
    Thanks received
    79
    Rep Power
    74
    Quote Originally Posted by hell kid View Post
    I have added
    Code:
    if (command[0].equals("dzone")) {
    			if (command.length > 1 && command[1].equals("all")) {
    				for (Player players : World.getPlayers()) {
    					if (players != null) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    						}
    					}
    				}
    			}
    		}
    I have put it under the membercommands section however it still doesn't work for any donator ranks.
    Woah I'm so sorry! I didn't even read your code (not going to lie I hate ruse methods)

    Code:
     if (command[0].equals("dzone")) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    }
    }
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Mar 2015
    Posts
    14
    Thanks given
    11
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by durky View Post
    Woah I'm so sorry! I didn't even read your code (not going to lie I hate ruse methods)

    Code:
     if (command[0].equals("dzone")) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    }
    }
    I changed the code
    Code:
    	private static void memberCommands(final Player player, String[] command, String wholeCommand)
    	{
    	 if (command[0].equals("dzone")) {
    						if (players.getRights().isMember()) {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    }
    }
    I got this error from changing the code
    Reply With Quote  
     

  10. #10  
    Registered Member
    wizzyt21's Avatar
    Join Date
    Aug 2007
    Posts
    1,167
    Thanks given
    49
    Thanks received
    12
    Rep Power
    156


    Try removing a brace from the command.

    So maybe like?
    Code:
    private static void memberCommands(final Player player, String[] command, String wholeCommand)
    	{
    	 if (command[0].equals("dzone")) {
    						if (players.getRights().isMember()) 
                                                           {
    							TeleportHandler.teleportPlayer(players, new Position(3094, 3503), TeleportType.NORMAL);
    }
    If it doesn't work like that, pm me your Skype and I'll teamviewer you and fix it myself.
    YOU JUST GOT KNOCKED THE F*CK UP.
    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. Replies: 52
    Last Post: 04-19-2009, 04:48 PM
  2. new command help plz?
    By runedevil69 in forum Requests
    Replies: 14
    Last Post: 01-06-2009, 08:03 PM
  3. RichScape command help?
    By Tonypker in forum Help
    Replies: 2
    Last Post: 01-03-2009, 01:36 PM
  4. item commaND HELP
    By `Lubricant in forum Tutorials
    Replies: 6
    Last Post: 08-03-2008, 09:11 PM
  5. basic command help(short tut)
    By Sub in forum Tutorials
    Replies: 2
    Last Post: 11-07-2007, 08:38 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
  •