Thread: simple commands rights

Results 1 to 9 of 9
  1. #1 simple commands rights 
    Registered Member
    Join Date
    Aug 2012
    Posts
    206
    Thanks given
    2
    Thanks received
    2
    Rep Power
    8
    if (playerCommand.startsWith("mute") && c.playerRights >= 1) {
    try {
    String playerToBan = playerCommand.substring(5);
    Connection.addNameToMuteList(playerToBan);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName
    .equalsIgnoreCase(playerToBan)) {
    Client c2 = (Client) Server.playerHandler.players[i];
    c2.sendMessage("You have been muted by: "
    + c.playerName);
    c2.sendMessage(" " + c2.playerName
    + " Got Muted By " + c.playerName + ".");
    break;
    }
    }
    }
    } catch (Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }

    my mute command the thign is donators can use it since they are rights 4 how do i fix?
    Come Play with us! at LonelyPvP.x90x.net
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Jul 2012
    Posts
    55
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    remove the && c.playerrights >= 1 and place it under this void

    public void moderatorCommands(Client c, String playerCommand)
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2012
    Posts
    206
    Thanks given
    2
    Thanks received
    2
    Rep Power
    8
    i dont have that void....
    Come Play with us! at LonelyPvP.x90x.net
    Reply With Quote  
     

  4. #4  
    Registered Member


    Join Date
    Sep 2010
    Posts
    1,213
    Thanks given
    87
    Thanks received
    159
    Rep Power
    726
    Code:
    if (playerCommand.startsWith("mute") && c.playerRights == 1) {
    try {
    String playerToBan = playerCommand.substring(5);
    Connection.addNameToMuteList(playerToBan);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName
    .equalsIgnoreCase(playerToBan)) {
    Client c2 = (Client) Server.playerHandler.players[i];
    c2.sendMessage("You have been muted by: "
    + c.playerName);
    c2.sendMessage(" " + c2.playerName
    + " Got Muted By " + c.playerName + ".");
    break;
    }
    }
    }
    } catch (Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    "“La vida es un suspiro, basta verla diferente para que ya sea mejor”
    -Canserbero


    圣地亚哥

    "You can't buy class, class comes by itself"
    -Zlatan Ibrahimović
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Jul 2012
    Posts
    55
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    Quote Originally Posted by LonelyPvP View Post
    i dont have that void....
    here you go then

    Code:
    if (playerCommand.startsWith("mute") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) {
    try {
    String playerToBan = playerCommand.substring(5);
    Connection.addNameToMuteList(playerToBan);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName
    .equalsIgnoreCase(playerToBan)) {
    Client c2 = (Client) Server.playerHandler.players[i];
    c2.sendMessage("You have been muted by: "
    + c.playerName);
    c2.sendMessage(" " + c2.playerName
    + " Got Muted By " + c.playerName + ".");
    break;
    }
    }
    }
    } catch (Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    assuming 1 = moderator 2 = admin 3 = owner 4 = donator

    in the future remember when a command in this format

    Code:
    (playerCommand.startsWith("mute") && c.playerRights >= 1)
    Code:
    c.playerRights >= 1
    means anybody with power 1 or greater can use this command
    and if you dont have the moderator voids and you want to change that you need to change it to something like this

    Code:
    c.playerRights == 1
    which fixes it so that only a moderator can now use that command and nobody else.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Nov 2011
    Posts
    134
    Thanks given
    6
    Thanks received
    1
    Rep Power
    11
    Code:
    if (playerCommand.equals("mute") && c.playerRights >= 1 && c.playerRights <= 3){
    //code
    }
    Now mods, admins, and owners, can use it, but not donors
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Nov 2011
    Posts
    134
    Thanks given
    6
    Thanks received
    1
    Rep Power
    11
    [QUOTE=Unearth;3540257]here you go then

    Code:
    if (playerCommand.startsWith("mute") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) {
    try {
    String playerToBan = playerCommand.substring(5);
    Connection.addNameToMuteList(playerToBan);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName
    .equalsIgnoreCase(playerToBan)) {
    Client c2 = (Client) Server.playerHandler.players[i];
    c2.sendMessage("You have been muted by: "
    + c.playerName);
    c2.sendMessage(" " + c2.playerName
    + " Got Muted By " + c.playerName + ".");
    break;
    }
    }
    }
    } catch (Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    Lmao, that would mean they would need player right 1,2, and 3, derp :/
    Reply With Quote  
     

  8. #8  
    Registered Member ARshadow's Avatar
    Join Date
    Aug 2011
    Posts
    470
    Thanks given
    30
    Thanks received
    41
    Rep Power
    53
    Quote Originally Posted by 24jared24 View Post
    Code:
    if (playerCommand.equals("mute") && c.playerRights >= 1 && c.playerRights <= 3){
    //code
    }
    Now mods, admins, and owners, can use it, but not donors
    This is the best way to do it (From all replies)
    Spoiler for Vouches:
    Quote Originally Posted by Liam Baby
    Vouch
    Quote Originally Posted by Mojo!
    vouch for adding killstreak system to my server
    Quote Originally Posted by jet kai
    Vouch for buying 28m of me, very fast, no hassle and trusted.
    All these vouches are on my profile, I just put it into quotes and in my signature to make it easier for users to find .
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Jul 2012
    Posts
    55
    Thanks given
    2
    Thanks received
    0
    Rep Power
    11
    [QUOTE=24jared24;3540259]
    Quote Originally Posted by Unearth View Post
    here you go then

    Code:
    if (playerCommand.startsWith("mute") && c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) {
    try {
    String playerToBan = playerCommand.substring(5);
    Connection.addNameToMuteList(playerToBan);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName
    .equalsIgnoreCase(playerToBan)) {
    Client c2 = (Client) Server.playerHandler.players[i];
    c2.sendMessage("You have been muted by: "
    + c.playerName);
    c2.sendMessage(" " + c2.playerName
    + " Got Muted By " + c.playerName + ".");
    break;
    }
    }
    }
    } catch (Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    Lmao, that would mean they would need player right 1,2, and 3, derp :/
    thats how mine were set up on my old server, must be wrong.
    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. Adding rights to commands?
    By Lation in forum Help
    Replies: 2
    Last Post: 07-19-2012, 09:33 PM
  2. commands player rights not working
    By ikbenpure5 in forum Help
    Replies: 8
    Last Post: 07-17-2012, 01:06 PM
  3. [PI] Player Rights and Commands
    By © Tyler © in forum Help
    Replies: 4
    Last Post: 11-07-2011, 12:41 AM
  4. ::bank commands for players rights 3.
    By Raw Envy in forum Help
    Replies: 1
    Last Post: 02-24-2011, 10:39 PM
  5. Giving rights with commands
    By Systəx in forum Tutorials
    Replies: 23
    Last Post: 07-23-2007, 10:08 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
  •