Thread: [PI-317] Pk Point Problem

Page 1 of 2 12 LastLast
Results 1 to 10 of 12
  1. #1 [PI-317] Pk Point Problem 
    Registered Member
    Join Date
    Aug 2011
    Posts
    62
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    I have searched through numerous tutorials on here and other sites and none seemed to fix this.

    Kills and Deaths in the wilderness are fine, the only problem is whenever you die to an npc anywhere on the server you earn pk points. What part am I missing here and what do I need to edit.

    Code:
    	public void applyDead() {
    		c.respawnTimer = 15;
    		c.isDead = false;
    		if (c.duelStatus != 6) {
    			c.killerId = findKiller();
    			Client o = (Client) Server.playerHandler.players[c.killerId];
    			if (o != null) {
    				c.DC++;
    				o.KC++;
    				c.playerKilled = c.playerId;
    				if (o.duelStatus == 5) {
    					o.duelStatus++;
    				}
    				if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled
    						&& !c.inPits) {
    					o.pkPoints += Misc.random(25);
    					o.lastKilled = Server.playerHandler.players[c.playerId].connectedFrom;
    				} else {
    					o.sendMessage("You do not recieve pk points because you have killed "
    							+ c.playerName + " twice in a row.");
    				}
    			}
    		}
    		c.faceUpdate(0);
    		c.npcIndex = 0;
    		c.playerIndex = 0;
    		c.stopMovement();
    		if (c.duelStatus <= 4) {
    			c.sendMessage("Oh dear you are dead!");
    		} else if (c.duelStatus != 6) {
    			c.sendMessage("You have lost the duel!");
    		}
    		resetDamageDone();
    		c.specAmount = 10;
    		c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    		c.lastVeng = 0;
    		c.vengOn = false;
    		resetFollowers();
    		c.attackTimer = 10;
    	}
    Reply With Quote  
     

  2. #2  
    Registered Member
    Join Date
    Dec 2011
    Age
    29
    Posts
    214
    Thanks given
    1
    Thanks received
    7
    Rep Power
    13
    I assume it's doing this:

    Code:
    o.pkPoints += Misc.random(25);

    It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic
    professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
    Reply With Quote  
     

  3. #3  
    Registered Member
    Join Date
    Aug 2011
    Posts
    62
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by buttaz54 View Post
    I assume it's doing this:

    Code:
    o.pkPoints += Misc.random(25);
    Yes, but that happens no matter where you die, should I make a return that says if you are in wilderness, give pk points, if inwild = false then return?
    Reply With Quote  
     

  4. #4  
    Registered Member
    Join Date
    Aug 2011
    Posts
    62
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Nevermind, thought I had it lol.
    Reply With Quote  
     

  5. #5  
    Registered Member
    Join Date
    Dec 2011
    Age
    29
    Posts
    214
    Thanks given
    1
    Thanks received
    7
    Rep Power
    13
    You could try, I am not understanding what is wrong with the code.

    Replace:

    Code:
    	if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled
    						&& !c.inPits)

    With:

    Code:
    	if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled && isInWild(or what ever you use) && !c.inPits)

    It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic
    professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
    Reply With Quote  
     

  6. #6  
    Registered Member
    Join Date
    Aug 2011
    Posts
    62
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    This keeps you from getting pk points if you die in fight caves, but gives them to you if you die anywhere else to an npc. I do not want you to get pkp if you die somewhere on the server, like Bandos or something. That's what's happening that I can't fix.

    Code:
    public void applyDead() {	
    		c.respawnTimer = 15;
    		c.isDead = false;
    		Client o = (Client) Server.playerHandler.players[c.killerId];
    		if(c.duelStatus != 6) {
    			c.killerId = findKiller();
    			if(o != null) {
    				if(!(c.npcIndex > 0) && c.inPits == false){
    				}
    				c.playerKilled = c.playerId;
    				if(o.duelStatus == 5) {
    					o.duelStatus++;
    				}
    				if (c.killerId != c.playerId)
    					o.sendMessage("You have defeated "+Misc.optimizeText(c.playerName)+" and received 4 pkPoints.");
    				if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled
    						&& !c.inPits) {
    					o.pkPoints += Misc.random(25);
    					o.lastKilled = Server.playerHandler.players[c.playerId].connectedFrom;
    				} else {
    				o.sendMessage("You have recently defeated "+c.playerName+", you don't receive any pk points.");
    }
    			
    		}
    	}
    		c.faceUpdate(0);
    			EventManager.getSingleton().addEvent(new Event() {
    				public void execute(EventContainer b) {
    		c.npcIndex = 0;
    		c.playerIndex = 0;
    				b.stop();
    				}
    				}, 2500);
    		c.stopMovement();
    		if(c.duelStatus <= 4) {
    			c.sendMessage("Oh dear you are dead!");
    		} else if(c.duelStatus != 6) {
    			c.sendMessage("You have lost the duel!");
    		}
    		resetDamageDone();
    		c.specAmount = 10;
    		c.getItems().addSpecialBar(c.playerEquipment[c.playerWeapon]);
    		c.lastVeng = 0;
    		c.vengOn = false;
    		resetFollowers();
    		c.attackTimer = 10;
    		removeAllWindows();
    		c.tradeResetNeeded = true;
    	}
    Reply With Quote  
     

  7. #7  
    Registered Member
    Join Date
    Dec 2011
    Age
    29
    Posts
    214
    Thanks given
    1
    Thanks received
    7
    Rep Power
    13
    I understand the problem you have, but idk why your code isn't working properly.

    It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic
    professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
    Reply With Quote  
     

  8. #8  
    Registered Member
    Join Date
    Aug 2011
    Posts
    62
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Quote Originally Posted by buttaz54 View Post
    I understand the problem you have, but idk why your code isn't working properly.
    and if I try to add in a !c.inWild into this

    if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled
    && !c.inPits) {

    it says that it cannot find the symbol, even though I am sure I'm importing server.model.players.Player;
    Reply With Quote  
     

  9. #9  
    Registered Member
    Join Date
    Aug 2011
    Posts
    62
    Thanks given
    0
    Thanks received
    2
    Rep Power
    11
    Fixed it, just changed
    if(!(c.npcIndex > 0) && c.inPits == false){

    to

    if(!(c.npcIndex < 0) && c.inPits == false){

    lol
    Reply With Quote  
     

  10. #10  
    Registered Member
    Join Date
    Dec 2011
    Age
    29
    Posts
    214
    Thanks given
    1
    Thanks received
    7
    Rep Power
    13
    1. It needs to be c.inWild not !c.inWild. That will make sure that the player is in the wild for that to even attempt to work.

    2. Show me that line of code after you added it.

    It should be noted that no ethically-trained software engineer would ever consent to write a DestroyBaghdad procedure. Basic
    professional ethics would instead require him to write a DestroyCity procedure, to which Baghdad could be given as a parameter.
    Reply With Quote  
     

Page 1 of 2 12 LastLast

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. [pi] pk point problem.
    By Rockstar Jax in forum Help
    Replies: 4
    Last Post: 05-30-2011, 10:45 PM
  2. Pk Point Problem
    By I'm A Jerk in forum Help
    Replies: 1
    Last Post: 03-18-2011, 12:48 AM
  3. [DSPK] pk point problem REPPING
    By Faqqot Jr in forum Help
    Replies: 16
    Last Post: 01-19-2011, 02:25 PM
  4. [PI] Pk Point PROBLEM
    By Faqqot Jr in forum Help
    Replies: 1
    Last Post: 01-07-2011, 07:46 AM
  5. PK Point Problem
    By Proffessor Oak in forum Help
    Replies: 11
    Last Post: 09-16-2010, 05:35 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •