Thread: [pi] PK SYSTEM

Results 1 to 7 of 7
  1. #1 [pi] PK SYSTEM 
    Donator
    noelbudo's Avatar
    Join Date
    Jul 2012
    Posts
    300
    Thanks given
    19
    Thanks received
    26
    Rep Power
    42
    My problem is when i kill someone i don't gain any pkp neither my current kills change on my quest tab i've looked everywhere every tutorial but i really cant seem to find the problem.

    Playerkilling:
    Code:
    package server.model.players;
    
    public class PlayerKilling {
    
    	private Client c;
    	
    	/**
    	* Constructor class
    	*/
    	
    	public PlayerKilling(Client Client) {
    		this.c = Client;
    	}
    	
    	/**
    	* How many people you have to kill before getting points again
    	* for killing the same person.
    	*/
    	
    	public final int NEEDED_KILLS = 10;
    	
    	/**
    	* First the method checks if the array list contains the person
    	* and if it doesn't then add there name but if it does then
    	* return the method false.
    	*/
    	
    	public boolean addPlayer(String i) {
    		if(!c.killedPlayers.contains(i)) {
    			c.killedPlayers.add(i);
    			return true;
    		}
    		return false;
    	}
    	
    	/**
    	* Checking if the array list contains the player and if
    	* the person has killed 20 or more people since that person.
    	*/
    	
    	public void checkForPlayer(String i) {
    		if(c.killedPlayers.contains(i) && c.killedPlayers.indexOf(i) >= NEEDED_KILLS) {
    			c.killedPlayers.remove(i);
    		}
    	}
    
    }
    if you need more info just tell me
    Reply With Quote  
     

  2. #2  
    Registered Member
    Karma_K's Avatar
    Join Date
    Nov 2012
    Posts
    4,283
    Thanks given
    152
    Thanks received
    610
    Rep Power
    108
    Quote Originally Posted by noelbudo View Post
    My problem is when i kill someone i don't gain any pkp neither my current kills change on my quest tab i've looked everywhere every tutorial but i really cant seem to find the problem.

    Playerkilling:
    Code:
    package server.model.players;
    
    public class PlayerKilling {
    
    	private Client c;
    	
    	/**
    	* Constructor class
    	*/
    	
    	public PlayerKilling(Client Client) {
    		this.c = Client;
    	}
    	
    	/**
    	* How many people you have to kill before getting points again
    	* for killing the same person.
    	*/
    	
    	public final int NEEDED_KILLS = 10;
    	
    	/**
    	* First the method checks if the array list contains the person
    	* and if it doesn't then add there name but if it does then
    	* return the method false.
    	*/
    	
    	public boolean addPlayer(String i) {
    		if(!c.killedPlayers.contains(i)) {
    			c.killedPlayers.add(i);
    			return true;
    		}
    		return false;
    	}
    	
    	/**
    	* Checking if the array list contains the player and if
    	* the person has killed 20 or more people since that person.
    	*/
    	
    	public void checkForPlayer(String i) {
    		if(c.killedPlayers.contains(i) && c.killedPlayers.indexOf(i) >= NEEDED_KILLS) {
    			c.killedPlayers.remove(i);
    		}
    	}
    
    }
    if you need more info just tell me
    i dont think this really involves playerkilling.java

    playerassistant
    Reply With Quote  
     

  3. #3  
    Kneel before me.

    Join Date
    Sep 2012
    Posts
    200
    Thanks given
    202
    Thanks received
    91
    Rep Power
    125
    go to playerassistant and there should by something like ApplyDead or something like that just search for "Oh Dear, you're dead" and make it so that your killstreak ends there or whatever. Where they kill them just do c.pkPoints += 1; or watever.
    Reply With Quote  
     

  4. #4  
    Donator
    noelbudo's Avatar
    Join Date
    Jul 2012
    Posts
    300
    Thanks given
    19
    Thanks received
    26
    Rep Power
    42
    Code:
    public void applyDead() {
    c.respawnTimer = 10;
    c.isDead = true;
    
    if(c.duelStatus != 6) {
    //c.killerId = c.getCombat().getKillerId(c.playerId);
    c.killerId = findKiller();
    Client o = (Client) Server.playerHandler.players[c.killerId];
    if(o != null) {
    o.pcPoints += 1; <---- i don't get this why is this here 0.o
    c.playerKilled = c.playerId;
    if (c.killerId != c.playerId);
    if (c.inWild()) {
    int deathMessage = Misc.random(8);
    if (deathMessage == 0) {
    o.sendMessage("@red@With a crushing blow, you defeat @blu@" + c.playerName + "!");
    } else if (deathMessage == 1) {
    o.sendMessage("@red@It's a humiliating defeat for @blu@" + c.playerName + "!");
    } else if (deathMessage == 2) { 
    o.sendMessage("@red@Do you ever die? Certainly NOT against @blu@" + c.playerName + "!");
    } else if (deathMessage == 3) {
    o.sendMessage("@red@You have defeated @blu@" + c.playerName + "!");
    } else if (deathMessage == 4) {
    o.sendMessage("@red@You have just dropped @blu@" + c.playerName + "!");
    } else if (deathMessage == 5) {
    o.sendMessage("@red@It's all over for @blu@" + c.playerName + "!");
    } else if (deathMessage == 6) {
    o.sendMessage("@red@You have killed @blu@" + c.playerName + "!");
    } else if (deathMessage == 7) {
    o.sendMessage("@red@Can anyone defeat you? Certainly not @blu@" + c.playerName + "!");
    } else if (deathMessage == 8) {
    o.sendMessage("@red@You were clearly a better fighter than @blu@" + c.playerName + "!");
    }
    } 
    if(o.duelStatus == 5) {
    o.duelStatus++;
    }
    }
    }
    where should i add the pkpoints thingy?
    and how could i make it so it give random pkp not only 1 or 5 but random pkp's
    Reply With Quote  
     

  5. #5  
    Kneel before me.

    Join Date
    Sep 2012
    Posts
    200
    Thanks given
    202
    Thanks received
    91
    Rep Power
    125
    just add c.pkPoints += 1; above
    Code:
    if (deathMessage == 0) {
    if you want a random amount of points per each kill just use Misc.Random
    Reply With Quote  
     

  6. #6  
    Donator
    noelbudo's Avatar
    Join Date
    Jul 2012
    Posts
    300
    Thanks given
    19
    Thanks received
    26
    Rep Power
    42
    still not working i've added the random misc but it isnt working i still don't gain pkp my method:
    Code:
    public void applyDead() {
    c.respawnTimer = 10;
    c.isDead = true;
    
    if(c.duelStatus != 6) {
    //c.killerId = c.getCombat().getKillerId(c.playerId);
    c.killerId = findKiller();
    Client o = (Client) Server.playerHandler.players[c.killerId];
    if(o != null) {
    o.pcPoints += 1;
    c.playerKilled = c.playerId;
    if (c.killerId != c.playerId);
    if (c.inWild()) {
    int deathMessage = Misc.random(8);
    if (deathMessage == 0) {
    c.pkPoints += 1;
    o.sendMessage("@red@With a crushing blow, you defeat @blu@" + c.playerName + "!");
    } else if (deathMessage == 1) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@It's a humiliating defeat for @blu@" + c.playerName + "!");
    } else if (deathMessage == 2) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@Do you ever die? Certainly NOT against @blu@" + c.playerName + "!");
    } else if (deathMessage == 3) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@You have defeated @blu@" + c.playerName + "!");
    } else if (deathMessage == 4) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@You have just dropped @blu@" + c.playerName + "!");
    } else if (deathMessage == 5) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@It's all over for @blu@" + c.playerName + "!");
    } else if (deathMessage == 6) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@You have killed @blu@" + c.playerName + "!");
    } else if (deathMessage == 7) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@Can anyone defeat you? Certainly not @blu@" + c.playerName + "!");
    } else if (deathMessage == 8) {
    c.pkPoints = Misc.random(7);
    o.sendMessage("@red@You were clearly a better fighter than @blu@" + c.playerName + "!");
    }
    } 
    if(o.duelStatus == 5) {
    o.duelStatus++;
    }
    }
    }
    Reply With Quote  
     

  7. #7  
    Registered Member Lucas Jacob's Avatar
    Join Date
    Jan 2012
    Posts
    183
    Thanks given
    0
    Thanks received
    5
    Rep Power
    0
    here my apply dead

    public void applyDead() {
    c.respawnTimer = 12;
    c.isDead = false;
    if(c.duelStatus != 6) {
    c.killerId = findKiller();
    Client o = (Client) PlayerHandler.players[c.killerId];
    if(o != null) {
    if(!PlayerKilling.hostOnList(o, c.connectedFrom)) {
    PlayerKilling.addHostToList(o, c.connectedFrom);
    o.pkp += 1;
    o.KC += 1;
    o.cStreak += 1;
    o.sendMessage("Your Player Killing Statistics has been updated:");
    o.sendMessage("Pk Points: <col=255>"+c.pkp+"</col>|| Current Killstreak: <col=255>"+c.hStreak+"</col>.");
    if(o.cStreak > o.hStreak) {
    o.hStreak = o.cStreak;
    o.sendMessage("<col=255>Congratulations, your Hightest kill streak has increased!");
    }
    } else {
    o.sendMessage("Because you have recently killed " + Misc.capitalize(c.playerName) + " you do not recieve Pk points.");
    }
    o.playerKilled = c.playerId;
    if(o.duelStatus == 5) {
    o.duelStatus++;
    }
    }
    }
    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. Replies: 5
    Last Post: 07-13-2011, 08:15 PM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •