Thread: [PI] Is it possible to make only 1 person use a certain command[PI]

Results 1 to 7 of 7
  1. #1 [PI] Is it possible to make only 1 person use a certain command[PI] 
    Registered Member jackd019's Avatar
    Join Date
    Aug 2011
    Posts
    431
    Thanks given
    5
    Thanks received
    8
    Rep Power
    11
    }

    if (playerCommand.startsWith("giveadmin") || playerCommand.startsWith("mellow") || playerCommand.startsWith("PKP") || playerCommand.startsWith("pkP")) {
    try {
    String playerToAdmin = playerCommand.substring(10);
    for(int i = 0; i < Config.MAX_PLAYERS; i++) {
    if(Server.playerHandler.players[i] != null) {
    if(Server.playerHandler.players[i].playerName.equalsIgnoreCase(playerToAdmin)) {
    Client c2 = (Client)Server.playerHandler.players[i];
    c2.sendMessage("You have been given admin status by " + c.playerName);
    c2.playerRights = 2;
    c2.logout();
    break;
    }
    }
    }
    But that does not work , how can i make only work for a certain user , This is a PI source . Suppor will be awesome
    Reply With Quote  
     

  2. #2  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,764
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    ofcourse is is, make your command like this:
    Code:
    if(playerCommand.startsWith("yourcommand") && c.playerName.equalsIgnoreCase("your name")) {
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  3. #3  
    q.q


    Join Date
    Dec 2010
    Posts
    6,535
    Thanks given
    1,072
    Thanks received
    3,534
    Rep Power
    4752
    && c.playerName.equalsIgnoreCase("name")
    Reply With Quote  
     

  4. #4  
    Registered Member jackd019's Avatar
    Join Date
    Aug 2011
    Posts
    431
    Thanks given
    5
    Thanks received
    8
    Rep Power
    11
    thanks sorry for being a noob coder haha cheers guys
    Reply With Quote  
     

  5. #5  
    Registered Member

    Join Date
    Aug 2011
    Posts
    2,764
    Thanks given
    297
    Thanks received
    534
    Rep Power
    1596
    Quote Originally Posted by jackd019 View Post
    thanks sorry for being a noob coder haha cheers guys
    no problem everyone needs to learn
    Quote Originally Posted by Aj View Post
    This is not even a tutorial. It's fail for rep. It's fail for life.
    Reply With Quote  
     

  6. #6  
    Registered Member Honakerscape's Avatar
    Join Date
    Jul 2011
    Posts
    110
    Thanks given
    3
    Thanks received
    2
    Rep Power
    1
    Yep, even like me
    Starting a Lure group. Need a legit partner.
    Reply With Quote  
     

  7. #7  
    Vitality.ps
    Raw Envy's Avatar
    Join Date
    Dec 2010
    Posts
    2,884
    Thanks given
    759
    Thanks received
    1,093
    DiscordTag
    Raw Envy#5379
    Rep Power
    2744
    Quote Originally Posted by spikeyyy View Post
    ofcourse is is, make your command like this:
    Code:
    if(playerCommand.startsWith("yourcommand") && c.playerName.equalsIgnoreCase("your name")) {
    This.
    [Only registered and activated users can see links. ]
    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. [PI] Command for only one person
    By RapeScape in forum Help
    Replies: 7
    Last Post: 03-19-2011, 12:47 AM
  2. Replies: 1
    Last Post: 01-30-2010, 11:50 AM
  3. Replies: 1
    Last Post: 06-22-2009, 07:23 AM
  4. Replies: 0
    Last Post: 03-21-2009, 04:46 AM
Tags for this Thread

View Tag Cloud

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •