Thread: [pi] Command

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [pi] Command 
    Registered Member
    Join Date
    Nov 2011
    Posts
    167
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Hello i was woundering if anyone had a command or something that
    can lock a certion command.

    Edit:

    Heres the command.

    if (playerCommand.equals("ffa")) {
    c.getPA().startTeleport(3333, 3333, 0, "modern");
    } else {
    c.sendMessage("This command is currently locked.");
    }
    }
    Reply With Quote  
     

  2. #2  
    need java lessons
    Eclipse's Avatar
    Join Date
    Aug 2012
    Posts
    4,436
    Thanks given
    686
    Thanks received
    898
    Rep Power
    490
    Make a Boolean. If you post the command you want to have restricted we can help you.

    Quote Originally Posted by jerryrocks317 View Post
    i am 14 and have my own laptop im on almost 24/7 currently creating rsps lol so please get off my thread lol
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Nov 2011
    Posts
    167
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Eclipse View Post
    Make a Boolean. If you post the command you want to have restricted we can help you.
    oh lol forgot it, heres the command :

    if (playerCommand.equals("ffa")) {
    c.getPA().startTeleport(3333, 3333, 0, "modern");
    } else {
    c.sendMessage("This command is currently locked.");
    }
    }
    Reply With Quote  
     

  4. #4  
    0x2be|~0x2be
    akamichael's Avatar
    Join Date
    Jan 2012
    Age
    28
    Posts
    73
    Thanks given
    1
    Thanks received
    8
    Rep Power
    44
    Declare a boolean either in the Player class or if it's just for that command declare it right above the command locally.

    example:

    //variable declaration
    public boolean commandLock = true;

    //now to use this with your commands simple place this code

    //if declared in the Player class
    Code:
    if(!c.commandLock)
    {
    if (playerCommand.equals("ffa")) {
    c.getPA().startTeleport(3333, 3333, 0, "modern");	
    }
    } else {
    c.sendMessage("This command is currently locked.");
    }
    //if declared locally in the Command class
    Code:
    if(!commandLock)
    {
    if (playerCommand.equals("ffa")) {
    c.getPA().startTeleport(3333, 3333, 0, "modern");	
    }
    } else {
    c.sendMessage("This command is currently locked.");
    }
    Reply With Quote  
     

  5. #5  
    Member
    Join Date
    Sep 2012
    Age
    27
    Posts
    172
    Thanks given
    22
    Thanks received
    7
    Rep Power
    0
    Code:
    public boolean canffa = true
    Code:
    if (playerCommand.equals("ffa")) {
    if (canffa) {
    c.getPA().startTeleport(3333, 3333, 0, "modern");
    } else {
    c.sendMessage("This command is currently unavailable");
    return;
    }
    }
    Code:
    if (playerCommand.equals("toggleffa")) {
    canffa ? true : false;
    }
    Not sure if the toggle will work, it's just as an example.
    Reply With Quote  
     

  6. #6  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Posts
    6,092
    Thanks given
    2,402
    Thanks received
    2,823
    Rep Power
    4550
    Config.java
    Code:
    public static boolean FFA_DISABLED = true;
    Commands.java
    Code:
        if (playerCommand.equals("ffa")) {
            if(Config.FFA_DISABLED) {
                c.sendMessage("FFA has been disabled or is currently 'locked'.");
                return;
            }
            c.getPA().startTeleport(3333, 3333, 0, "modern");    
        }
        
        if(playerCommand.equals("freeforall") && c.playerRights > 0) {
            Config.FFA_DISABLED = FFA_DISABLED ? FFA_DISABLE = false : FFA_DISABLED = true;
        }
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Nov 2011
    Posts
    167
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Thanks guys, but it only locks the command for ever locks it.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Nov 2010
    Posts
    93
    Thanks given
    8
    Thanks received
    0
    Rep Power
    6
    if you don't want people being able to use a command, just make the command only available for yourself or staff members. depending on what you want.
    Reply With Quote  
     

  9. #9  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Quote Originally Posted by xaronx View Post
    Thanks guys, but it only locks the command for ever locks it.
    Create another command to unlock it then..
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Nov 2011
    Posts
    167
    Thanks given
    2
    Thanks received
    1
    Rep Power
    11
    Quote Originally Posted by Karma_K View Post
    Create another command to unlock it then..
    i mean it locks it only for the person who locked it. no one else
    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. [PI] Command Stopping people attacking you
    By Pentiun in forum Snippets
    Replies: 17
    Last Post: 02-25-2012, 11:19 PM
  2. Lil PI Command
    By FuckThePolice in forum Help
    Replies: 0
    Last Post: 08-08-2010, 03:17 AM
  3. [PI] Command help. [PI]
    By Ross in forum Help
    Replies: 0
    Last Post: 07-27-2010, 07:11 PM
  4. PI command error
    By Despised Icon in forum Help
    Replies: 2
    Last Post: 06-09-2010, 09:11 PM
  5. [PI] Commands and remove x dupe
    By Analed in forum Requests
    Replies: 4
    Last Post: 05-28-2010, 07:22 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •