Thread: New rank not working correctly [pi]

Results 1 to 5 of 5
  1. #1 New rank not working correctly [pi] 
    Registered Member
    Join Date
    Jan 2014
    Posts
    90
    Thanks given
    17
    Thanks received
    4
    Rep Power
    11
    i added a "premium donator" rank recently which is player rights = 5 and the problem i am having is that with those player rights, you can do any of the moderator commands (jail, mute, ban, etc.) the server isnt released yet though so its not a huge deal yet. obviously when i release it, it will be though so i was wandering how to fix it.. here are my current mod commands.

    public void moderatorCommands(Client c, String playerCommand)
    {
    if (playerCommand.equals("staffzone") && c.playerRights >= 1) {
    c.getPA().startTeleport(2095, 4428, 0, "modern");
    }
    if (playerCommand.startsWith("checkinv") && c.playerRights >= 1) {
    try {
    String[] args = playerCommand.split(" ", 2);
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    Client o = (Client) Server.playerHandler.players[i];
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1])) {
    c.getPA().otherInv(c, o);
    break;
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    if(playerCommand.startsWith("jail")) {
    try {
    String playerToBan = playerCommand.substring(5);
    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.teleportToX = 3102;
    c2.teleportToY = 9516;
    c2.Jail = true;
    c2.sendMessage("You have been jailed by "+c.playerName+"");
    c.sendMessage("Successfully Jailed "+c2.playerName+".");
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    if (playerCommand.startsWith("mute")) {
    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);
    c.sendMessage("You have muted: " + c2.playerName);
    break;
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }

    if (playerCommand.startsWith("xteleto")) {
    String name = playerCommand.substring(8);
    for (int i = 0; i < Config.MAX_PLAYERS; i++) {
    if (Server.playerHandler.players[i] != null) {
    if (Server.playerHandler.players[i].playerName.equalsIgnoreCase(name)) {
    c.getPA().movePlayer(Server.playerHandler.players[i].getX(), Server.playerHandler.players[i].getY(), Server.playerHandler.players[i].heightLevel);
    }
    }
    }
    }
    if (playerCommand.startsWith("unmute")) {
    try {
    String playerToBan = playerCommand.substring(7);
    Connection.unMuteUser(playerToBan);
    c.sendMessage("Unmuted.");
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }

    if (playerCommand.startsWith("checkbank")) {
    String[] args = playerCommand.split(" ");
    for(int i = 0; i < Config.MAX_PLAYERS; i++)
    {
    Client o = (Client) Server.playerHandler.players[i];
    if(Server.playerHandler.players[i] != null)
    {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(args[1]))
    {
    c.getPA().otherBank(c, o);
    break;
    }
    }
    }
    }


    if (playerCommand.startsWith("kick") && playerCommand.charAt(4) == ' ') {
    try {
    String playerToBan = playerCommand.substring(5);
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    Server.playerHandler.players[i].disconnected = true;
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    if (playerCommand.startsWith("ban") && playerCommand.charAt(3) == ' ') {
    try {
    String playerToBan = playerCommand.substring(4);
    Connection.addNameToBanList(playerToBan);
    Connection.addNameToFile(playerToBan);
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToBan)) {
    Server.playerHandler.players[i].disconnected = true;
    Client c2 = (Client)Server.playerHandler.players[i];
    c2.sendMessage(" " +c2.playerName+ " Got Banned By " + c.playerName+ ".");
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    if (playerCommand.startsWith("unban")) {
    try {
    String playerToBan = playerCommand.substring(6);
    Connection.removeNameFromBanList(playerToBan);
    c.sendMessage(playerToBan + " has been unbanned.");
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }
    if(playerCommand.startsWith("unjail")) {
    try {
    String playerToBan = playerCommand.substring(7);
    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.teleportToX = 2524;
    c2.teleportToY = 4777;
    c2.monkeyk0ed = 0;
    c2.Jail = false;
    c2.sendMessage("You have been unjailed by "+c.playerName+".");
    c.sendMessage("Successfully unjailed "+c2.playerName+".");
    }
    }
    }
    } catch(Exception e) {
    c.sendMessage("Player Must Be Offline.");
    }
    }

    }



    not sure how to fix this, but the thing i think is weird is that playerRights 4 is a donator and they cant use these commands.. could someone please fix this for me? is is something like this? c.playerRights == 1 && c.playerRights == 2 && c.playerRights == 3) {

    im not good at coding i dont even know what to do lol
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    You're probably identifying your mod commands as playerRights above 0 or something to be only able to use it, 5 is above 0 so that's why it's able to.. You have to add something like this

    if (player.playerRights >= 0 && !player.playerRights == 5) {

    So it says every right above 0, but not 5 can use the command.
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Registered Member
    Join Date
    Jan 2014
    Posts
    90
    Thanks given
    17
    Thanks received
    4
    Rep Power
    11
    but playerRights = 4 cant use the commands so it cant be 0 + because that wouldnt make any sense. but i will try what u just gave me
    Reply With Quote  
     

  5. #4  
    Registered Member
    Join Date
    May 2013
    Posts
    1,169
    Thanks given
    28
    Thanks received
    133
    Rep Power
    53
    Quote Originally Posted by 999mageking View Post
    but playerRights = 4 cant use the commands so it cant be 0 + because that wouldnt make any sense. but i will try what u just gave me
    Like I said, idk how your command system is identifying what playerRights can do what.. If you don't want rights 4 to be able to use the command either, just add && !player.playerRights == 4 to what I gave you, similar to what I posted for rights 5
    You could also do this..

    if (player.playerRights >= 0 && player.playerRights <= 4) {

    Which says all rights above 0 and below 4 can do whatever
    If only I hadn't given you up, my life could've been different.
    Reply With Quote  
     

  6. Thankful user:


  7. #5  
    Registered Member
    Join Date
    Jan 2014
    Posts
    90
    Thanks given
    17
    Thanks received
    4
    Rep Power
    11
    ok ok, i think it might work. got a few errors with that code but i worked it out. going to add to all mod commands and then test. ill report back. in the meantime i thanked you
    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: 8
    Last Post: 09-03-2013, 08:35 AM
  2. Replies: 0
    Last Post: 09-02-2013, 07:11 AM
  3. [PI] Webclient not working correctly
    By 'iStink in forum Help
    Replies: 7
    Last Post: 03-31-2011, 01:52 PM
  4. Veng not working correctly
    By Danger-Scape in forum Help
    Replies: 3
    Last Post: 07-19-2010, 01:38 AM
  5. Replies: 12
    Last Post: 07-11-2009, 02:33 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
  •