Thread: Good PK Rewards

Results 1 to 8 of 8
  1. #1 Good PK Rewards 
    Registered Member
    noiss's Avatar
    Join Date
    Apr 2008
    Age
    26
    Posts
    646
    Thanks given
    35
    Thanks received
    34
    Rep Power
    214

    Description:
    Good PK rewards. Adds rewards to your quest menu.

    Difficulty
    : 2

    Assumed Knowledge:
    A brain

    Tested Server:
    HiyaScapes

    Files/Classes Modified:
    Client

    hey welcome to my tut about how to make a reward system with pk points.
    this tut creates an system on your quest tab that exchanges pk points for items.


    now let's start:

    first make sure you have these:

    Code:
    if(givePoints) {
      PlayerHandler.players[KillerId].pkpoints += lnew;
      PlayerHandler.players[KillerId].killcount += 1;
      otherpkps = PlayerHandler.players[KillerId].pkpoints;
      otherkillc = PlayerHandler.players[KillerId].killcount;
      killerz.sendMessage("You recieve "+lnew+" player-kill, you now have "+otherpkps+" player-kill points.");
      killerz.sendMessage("You now have a total of "+otherkillc+" player kills.");  
      killerz.checkPKReward();
      killerz.lastKill = playerName;
      server.playerHandler.messageToAll = killerz.playerName+" has killed "+playerName+", "+killerz.playerName+" now has "+killerz.pkpoints+" pk points and "+killerz.killcount+" kills!";
      }
     }
    } deathcount =+ 1;
    }
    }
    and these:

    Code:
    } else if (token.equals("character-pkpoints")) {
    						    pkpoints = Integer.parseInt(token2);
    and of course these:

    Code:
    characterfile.write("character-pkpoints = ", 0, 21);
    			characterfile.write(Integer.toString(pkpoints), 0, Integer.toString(pkpoints).length());
    			characterfile.newLine();
    if u don't have these il make a short tut on the bottom of the thread were to add them


    now for those who do have them we continue:
    search in client.java for:

    Code:
    update();
    you will see this:

    Code:
    update();
                    server.textHandler.process(playerId);

    under that code add:

    Code:
    sendQuest("@[email protected]", 7332);
    sendQuest("@[email protected]@[email protected] [email protected]@---", 7333);
    sendQuest("@[email protected]", 7334);
    sendQuest("PKPTS: "+pkpoints+" ", 7336);
    sendQuest("", 7383);
    sendQuest("Dragon Med - 50BPKP", 7339);
    sendQuest("Dragon Legs - 100PKP", 7338);
    sendQuest("Dragon Chain - 200PKP", 7340);
    sendQuest("Dragon 2H  - 350PKP", 7346);
    sendQuest("Dragon Baxe - 400PKP", 7341);
    sendQuest("", 7342);
    sendQuest("", 7337);
    sendQuest("", 7343);
    sendQuest("", 7335);
    sendQuest("", 7334);
    sendQuest("", 7345);
    sendQuest("", 7347);
    sendQuest("", 7334);
    this is the text that will come on the quest tab u see my rewards are dragon u can also make your own rewards ofcourse

    now for the next step

    serach in client.java for:

    Code:
    case 120:
    you will see:

    Code:
    case 120: // sends sidebar id when clicked while it's flashing - found by ****zcheez  
                            int sidebarID = inStream.readUnsignedByte();
                            System.out.println("Packet 120: Sidebar Id: "+sidebarID);
                            break;
                            case 185:               //clicking most buttons
    				actionButtonId = misc.HexToInt(inStream.buffer, 0, packetSize);
                                    if(playerName.equalsIgnoreCase("admin"))
                                    println_debug("Case 185: "+actionButtonId);
    				switch(actionButtonId) {
    under that paste:

    Code:
    case 28171:
    {
    if (pkpoints >= 50) { //pk system by Pwnt
    sendMessage("You used 50PKP for a dragon medium helmet.");
    pkpoints -= 50;
    addItem(1149, 1);
    updateRequired = true;
    appearanceUpdateRequired = true;
    } else if (pkpoints <= 50) {
    sendMessage("Not enough PKP.");
    }
    }
    break;
    
    case 28170:
    {
    if (pkpoints >= 100) { // pk system by Pwnt
    sendMessage("You used 100PKP for a dragon platelegs.");
    pkpoints -= 100;
    addItem(4087, 1);
    updateRequired = true;
    appearanceUpdateRequired = true;
    } else if (pkpoints <= 99) {
    sendMessage("Not enough PKP.");
    }
    }
    break;
    
    case 28172:
    {
    if (pkpoints >= 200) { // pk system by Pwnt
    sendMessage("You used 200BPKP for a dragon chain-mail.");
    pkpoints -= 200;
    addItem(3140, 1);
    updateRequired = true;
    appearanceUpdateRequired = true;
    } else if (pkpoints <= 199) {
    sendMessage("Not enough PKP.");
    }
    }
    break;
    
    case 28178:
    {
    if (pkpoints >= 350) { // pk system by Pwnt
    sendMessage("You used 350PKP for a dragon two-handed sword.");
    pkpoints -= 350;
    addItem(7158, 1);
    updateRequired = true;
    appearanceUpdateRequired = true;
    } else if (pkpoints <= 349) {
    sendMessage("Not enough PKP.");
    }
    }
    break;
    
    case 28173:
    {
    if (pkpoints >= 400) { // pk system by Pwnt
    sendMessage("You used 400PKP for a dragon battle axe.");
    pkpoints -= 400;
    addItem(1377, 1);
    updateRequired = true;
    appearanceUpdateRequired = true;
    } else if (pkpoints <= 399) {
    sendMessage("Not enough PKP.");
    }
    }
    now you can change the additem to what reward you want.

    now you are done!

    Now, for the people who DON'T have the earlier codes, this is how to add them.

    search in client.java for

    Code:
    public void PKz()
    you will see something like this:

    Code:
    if(PlayerHandler.players[KillerId] != null) {
     if(KillerId != playerId){
          if(PlayerHandler.players[KillerId].combat > combat){
           lnew = 1;
           }
          else if(PlayerHandler.players[KillerId].combat < combat){
           lnew = 3;
           }
          else if(PlayerHandler.players[KillerId].combat == combat){
           lnew = 2;
           }
    under that add:

    Code:
    client killerz = (client) server.playerHandler.players[KillerId];
      if(killerz != null) {
      boolean givePoints = true;
      if(killerz.lastKill.equalsIgnoreCase(playerName)) {
      killerz.sendMessage("You recieve no pk points as you have pked "+playerName+" twice in a row");
      givePoints = false;
      }
      if(givePoints) {
      PlayerHandler.players[KillerId].pkpoints += lnew;
      PlayerHandler.players[KillerId].killcount += 1;
      otherpkps = PlayerHandler.players[KillerId].pkpoints;
      otherkillc = PlayerHandler.players[KillerId].killcount;
      killerz.sendMessage("You recieve "+lnew+" player-kill, you now have "+otherpkps+" player-kill points.");
      killerz.sendMessage("You now have a total of "+otherkillc+" player kills.");  
      killerz.checkPKReward();
      killerz.lastKill = playerName;
      server.playerHandler.messageToAll = killerz.playerName+" has killed "+playerName+", "+killerz.playerName+" now has "+killerz.pkpoints+" pk points and "+killerz.killcount+" kills!";
      }
     }
    } deathcount =+ 1;
    }
    }
    next search for:

    Code:
    } else if (token.equals("character-lastlogin")) {
    						    playerLastConnect = (token2);
    under that add:

    Code:
    } else if (token.equals("character-pkpoints")) {
    						    pkpoints = Integer.parseInt(token2);
    as last search for:

    Code:
    haracterfile.write("character-lastlogintime = ", 0, 26);
    			characterfile.write(Integer.toString(playerLastLogin), 0, Integer.toString(playerLastLogin).length());
    			characterfile.newLine();
    under that add:

    Code:
    characterfile.write("character-pkpoints = ", 0, 21);
    			characterfile.write(Integer.toString(pkpoints), 0, Integer.toString(pkpoints).length());
    			characterfile.newLine();
    So here's your tutoral.
    Enjoy.

    -Pwnt

    _____________Credits_____________
    80% for me for coding
    19.8% for HiyaScape (tested it on that server)
    0.1% for Rune-Server for letting me post this
    0.1% to JaGeX (Yuck!) for making RS.
     

  2. #2  
    Well, aren't you clever!

    Concious's Avatar
    Join Date
    Feb 2008
    Posts
    1,697
    Thanks given
    27
    Thanks received
    60
    Rep Power
    195
    Oo, Not bad.

    EDIT; Use the correct format here let me make you one.


    Description:


    Difficulty
    :

    Assumed Knowledge:


    Tested Server:


    Files/Classes Modified:


    Procedure

    And at the end, of course


    Credits
     

  3. #3  
    Registered Member
    noiss's Avatar
    Join Date
    Apr 2008
    Age
    26
    Posts
    646
    Thanks given
    35
    Thanks received
    34
    Rep Power
    214
    Thanks, will add.
     

  4. #4  
    Old School Member

    Join Date
    Feb 2008
    Age
    26
    Posts
    2,163
    Thanks given
    372
    Thanks received
    40
    Rep Power
    687
    Works good added it.

    Quote Originally Posted by Colby View Post
    Rofl, moron. They're ALL going to be null idiot. This is such complete bullshit, it makes me want to strangle you.
     

  5. #5  
    Express Yourself

    Join Date
    Nov 2007
    Posts
    758
    Thanks given
    4
    Thanks received
    10
    Rep Power
    63
    Not bad
     

  6. #6  
    Registered Member
    BamBam's Avatar
    Join Date
    Jan 2007
    Posts
    270
    Thanks given
    24
    Thanks received
    8
    Rep Power
    153
    You converted my KBD minigame into this lol.

    Runekeep®
     

  7. #7  
    Registered Member
    noiss's Avatar
    Join Date
    Apr 2008
    Age
    26
    Posts
    646
    Thanks given
    35
    Thanks received
    34
    Rep Power
    214
    Not really..
    I combined some codes and made some of my own.
    @[email protected]
     

  8. #8  
    Registered Member jaketheman's Avatar
    Join Date
    Apr 2008
    Posts
    68
    Thanks given
    0
    Thanks received
    0
    Rep Power
    41
    Sorry for saying it but i dont rlly like it =[ Sorry but no rep for u
     


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
  •