Thread: Pk ban command

Results 1 to 9 of 9
  1. #1 Pk ban command 
    Lynxx
    Guest
    I have it set so that if q20 = 1 they cannot mage or attack a player, now i need a command that if typed in such as ::banpk Zach it will put q20 = 1 on Zach and dc him..Please
    Reply With Quote  
     

  2. #2  
    Member #35, most veteran member left? :D


    Join Date
    Jul 2006
    Age
    30
    Posts
    2,660
    Thanks given
    53
    Thanks received
    331
    Rep Power
    925
    Code:
    if (command.startsWith("banpk")) {
    	int p2 = Server.playerHandler.players[getPlayerID(command.substring(6))];
    	p2.q20 = 1;
    	p2.disconnected = true;
    	sendMessage("You have banned "+p2.playerName+" from PKing.");
    }
    You most likely will get some errors.


    `Ex-global moderator x3 (resigned)
    Reply With Quote  
     

  3. #3  
    Lynxx
    Guest
    Delta please..
    Reply With Quote  
     

  4. #4  
    Member #35, most veteran member left? :D


    Join Date
    Jul 2006
    Age
    30
    Posts
    2,660
    Thanks given
    53
    Thanks received
    331
    Rep Power
    925
    Quote Originally Posted by Lynxx View Post
    Delta please..
    Ok did you try that? The only sure fix I know for an error is changing "sendMessage" to "sM".


    `Ex-global moderator x3 (resigned)
    Reply With Quote  
     

  5. #5  
    Registered Member The Turk's Avatar
    Join Date
    Nov 2009
    Posts
    295
    Thanks given
    0
    Thanks received
    0
    Rep Power
    50
    deltas sM isnt it?
    Reply With Quote  
     

  6. #6  
    Registered Member
    PSNB's Avatar
    Join Date
    Aug 2009
    Posts
    885
    Thanks given
    8
    Thanks received
    103
    Rep Power
    590
    Quote Originally Posted by Runite View Post
    Code:
    if (command.startsWith("banpk")) {
    	int p2 = Server.playerHandler.players[getPlayerID(command.substring(6))];
    	p2.q20 = 1;
    	p2.disconnected = true;
    	sendMessage("You have banned "+p2.playerName+" from PKing.");
    }
    You most likely will get some errors.
    That won't work. You've set 'p2' as an Integer rather than a Player. Just letting you know.
    Reply With Quote  
     

  7. #7  
    Lynxx
    Guest
    Runite
    Code:
    client.java:7984: package Server does not exist
            int p = Server.playerHandler.players[getPlayerID(command.substring(6))];
    
                          ^
    client.java:7984: cannot find symbol
    symbol  : method getPlayerID(java.lang.String)
    location: class client
            int p = Server.playerHandler.players[getPlayerID(command.substring(6))];
    
                                                 ^
    client.java:7985: int cannot be dereferenced
            p.q20 = 1;
             ^
    client.java:7986: int cannot be dereferenced
            p.disconnected = true;
             ^
    client.java:7987: int cannot be dereferenced
            sM("You have banned "+p.playerName+" from PKing.");
                                   ^
    Note: EconomyReset.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    5 errors
    Your mom has to press any key to continue...
    Press any key to continue . . .
    Reply With Quote  
     

  8. #8  
    ̿ ̿̿ ̿̿ ̿̿̿'̿'\̵͇̿̿\=(•̪

    Dragonking's Avatar
    Join Date
    May 2008
    Posts
    2,011
    Thanks given
    16
    Thanks received
    31
    Rep Power
    567
    Quote Originally Posted by Lynxx View Post
    Runite
    Code:
    client.java:7984: package Server does not exist
            int p = Server.playerHandler.players[getPlayerID(command.substring(6))];
    
                          ^
    client.java:7984: cannot find symbol
    symbol  : method getPlayerID(java.lang.String)
    location: class client
            int p = Server.playerHandler.players[getPlayerID(command.substring(6))];
    
                                                 ^
    client.java:7985: int cannot be dereferenced
            p.q20 = 1;
             ^
    client.java:7986: int cannot be dereferenced
            p.disconnected = true;
             ^
    client.java:7987: int cannot be dereferenced
            sM("You have banned "+p.playerName+" from PKing.");
                                   ^
    Note: EconomyReset.java uses or overrides a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    5 errors
    Your mom has to press any key to continue...
    Press any key to continue . . .
    look at your other commands to find how it gets the player id and lol @
    Your mom has to press any key to continue...
    Reply With Quote  
     

  9. #9  
    Fuck yeah!
    Mergim's Avatar
    Join Date
    May 2009
    Age
    31
    Posts
    2,309
    Thanks given
    218
    Thanks received
    187
    Rep Power
    1619
    Just look for a promote command. remove p.playerRights = #; and put p.q20 = 1;
    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

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