Thread: [PI] adding Pk Points

Page 2 of 2 FirstFirst 12
Results 11 to 14 of 14
  1. #11  
    Registered Member
    Join Date
    Dec 2010
    Posts
    19
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by Pietz View Post
    took me 3 seconds if that learn to use the search bar.... [Only registered and activated users can see links. ]

    Read what I just said in my last reply... I don't know where to add it

    Code:
    import java.util.ArrayList;
    import java.util.List;
    
    import server.event.Event;
    import server.event.EventContainer;
    import server.event.EventManager;
    
    /**
     * Player VS Player Point gaining
     * @author <RogueX>
     *
     */
    public class PlayerKilling {
    
    	/**
    	 * Time in minutes to wait before you may gain another PK Point from the same Client
    	 */
    	private static final short TIME_TOWAIT = 10;
    	
    	/**
    	 * Holds our Client and Attacker objects
    	 */
    	private static List<PlayerKill> playerKills = new ArrayList<PlayerKill>();
    	
    	/**
    	 * Runs multiple checks to see if the Attacker is valid for a Player Vs Player Point
    	 * @param c Client who died
    	 * @param a Client the attacker
    	 */
    	public static void addKill(Client c, Client a) {
    		for (PlayerKill pk : playerKills) {
    			if (pk.playerName.equalsIgnoreCase(c.playerName)
    					&& pk.attackerName.equalsIgnoreCase(a.playerName)
    					|| pk.ipAddress.equalsIgnoreCase(c.connectedFrom)
    					&& pk.attackerIP.equalsIgnoreCase(a.connectedFrom)) {
    				a.sendMessage("PK Point not given. You may not kill the same person within " + TIME_TOWAIT + " minutes.");
    				return;
    			}
    		}
    		final PlayerKill tempPK = new PlayerKill(c.playerName, c.connectedFrom,	a.playerName, a.connectedFrom);
    		playerKills.add(tempPK);
    		a.pkPoints += 1;
    		a.sendMessage("You have gained 1 PK Point. You now have " + a.pkPoints + " PK Points.");
    		EventManager.getSingleton().addEvent(new Event() {
    			public void execute(EventContainer ec) {
    				playerKills.remove(tempPK);
    				ec.stop();
    			}
    		}, TIME_TOWAIT * 1000);
    		return;
    	}
    
    }
    
    /**
     * Object to hold the client and attackers information
     */
    
    class PlayerKill {
    
    	String playerName;
    	String ipAddress;
    	String attackerName;
    	String attackerIP;
    
    	public PlayerKill(String a, String b, String c, String d) {
    		this.playerName = a;
    		this.ipAddress = b;
    		this.attackerName = c;
    		this.attackerIP = d;
    	}
    
    }
    Code:
    PlayerKilling.addKill(c, o);

    Where would I put both of these? And btw thank you for getting that for me but I just don't know where to put this
    Reply With Quote  
     

  2. #12  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Age
    21
    Posts
    4,936
    Thanks given
    1,347
    Thanks received
    1,662
    Rep Power
    1270
    This is rediculous, all of this is unnecessary.

    Step 1, Add this Integer
    Code:
    pkPoints
    Step 2, go to your character saving class and make it so pkPoints will save within your character info

    step 3, in your death method add someting similar to this
    Code:
    o.pkPoints+= 6+Misc.random(8);
    basic, simple, pkpoints.

    Reply With Quote  
     

  3. #13  
    Registered Member
    Join Date
    Dec 2010
    Posts
    19
    Thanks given
    0
    Thanks received
    0
    Rep Power
    1
    Quote Originally Posted by Algorithmô View Post
    This is rediculous, all of this is unnecessary.

    Step 1, Add this Integer
    Code:
    pkPoints
    Step 2, go to your character saving class and make it so pkPoints will save within your character info

    step 3, in your death method add someting similar to this
    Code:
    o.pkPoints+= 6+Misc.random(8);
    basic, simple, pkpoints.

    THANK YOU ! This is all I wanted just a tut on where to put it.. i've done it now..
    Reply With Quote  
     

  4. #14  
    Donator

    Jason's Avatar
    Join Date
    Aug 2009
    Age
    21
    Posts
    4,936
    Thanks given
    1,347
    Thanks received
    1,662
    Rep Power
    1270
    you're welcome, have fun with your new system

    Reply With Quote  
     

Page 2 of 2 FirstFirst 12

Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 7
    Last Post: 12-28-2009, 08:30 PM
  2. Devo 2.7 adding points when you kill an npc
    By pk3r john in forum Help
    Replies: 11
    Last Post: 11-09-2009, 01:17 AM
  3. [525] Adding Pk Points (dont save)
    By Ramsin in forum Snippets
    Replies: 21
    Last Post: 05-24-2009, 04:10 PM
  4. Adding a pvp points system.
    By brok3nangel in forum Help
    Replies: 4
    Last Post: 02-07-2009, 09:28 PM
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
  •