Thread: [Req] Farm Proof PK system [Req]

Results 1 to 3 of 3
  1. #1 [Req] Farm Proof PK system [Req] 
    Ultimatum
    Guest
    *Note* Im on my mobile phone, so excus any mispeled words.

    I currently hav a pk point system, but I need the code(s) to prevent farming.

    ANYTHING preventing pk point farming would be appreciated.

    will rep+
    Reply With Quote  
     

  2. #2  
    Banned

    Join Date
    Jan 2009
    Age
    28
    Posts
    2,662
    Thanks given
    66
    Thanks received
    207
    Rep Power
    0
    public String lastKiller "";

    When You Killer Somone Like Lets Say

    PlayerA Vs PlayerB

    Player A Killers PlayerB

    lastKiller = "PlayerB";

    Now When You Go To Kill Somone

    Do For What Ever Gives The Pk Points If Killed

    Add This

    if(Killed.playerName != lastKiller){
    Points System Add Here
    } else {
    sendMessage("You've Already Killed This Player");
    }


    Now You'll Also Need To Write This To Char Files So Logging Out Isnt An Option.
    Reply With Quote  
     

  3. #3  
    Expert Programmer


    Join Date
    Dec 2007
    Posts
    2,018
    Thanks given
    52
    Thanks received
    84
    Rep Power
    986
    Code:
    
    private int pkPoints = 0;
    
    private String[] lastKills = new String[maxPlayers];
    
    private int getFreeSlot(String[] a) {
    ** *int slot = 0;
    ** *for(int i = 0; i < a.length; i++) {
    ** * * * if(a[i] == null) {
    ** * * * * * *slot = i;
    ** * * * *}
    ** *}
    ** *return slot;
    }
    
    public void awardPoints(Client target) {
          int killedTarget = 0;
          for(String s : lastKills) {
                if(target.playerName == s)
                      killedTarget++;
          }** **
          if(killedTarget < 3) {
                pkPoints++;
                lastKills[getFreeSlot(lastKills)] = target.playerName;
          } else {
                sendMessage("Killed this dude more than 3 times in last hour!");
          }
    }
    wrote this on ma iPod it shud work though aall u gotta do is make lastkils reset every 1 hr or so
    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
  •