Thread: pi when a player dies he still regens health

Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1 pi when a player dies he still regens health 
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    So when a player gets 0 hp, and dies he still regenerates health, how can this be fixed?

    Code:
    		public void applyDead() {	
    		c.respawnTimer = 15;
    		c.isDead = false;
    
    		
    		
    		
    		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) {
    			    c.DC++;
                    o.KC++;
    				if (c.killerId != c.playerId)
    						
    
    				c.playerKilled = c.playerId;
    				if(o.duelStatus == 5) {
    					o.duelStatus++;
    				}
    if (c.inCC()) {
    	o.getItems().addItem(995, 10000000);
    	o.sendMessage("@blu@You receive 10m for killing "+c.playerName+"!");
    	Server.clanChat.sendTeamWarsMessage(c.clanId, c.playerName+" Has been killed in Team Wars.");
    }
    				if(!(c.npcIndex > 0) && c.inPits == false){
    				}
    				if (c.inWild() && !c.inFunPk() && !c.inCC())
    				if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled) {
    					o.sendMessage("You have defeated "+Misc.optimizeText(c.playerName)+"!");
    					o.sendMessage("and received 2 PvP Points!");     
    					o.pkPoints = (o.pkPoints + 2);
    					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.");
    						if (c.inFunPk())
    							c.sendMessage("You do not recieve PKP in FunPK");
    						return;
    					}
    			}
    			}
    		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  
     

  2. #2  
    Banned
    Join Date
    Jun 2013
    Posts
    205
    Thanks given
    93
    Thanks received
    28
    Rep Power
    0
    Post your apply dead method.
    Reply With Quote  
     

  3. #3  
    Banned

    Join Date
    Nov 2010
    Age
    14
    Posts
    2,639
    Thanks given
    158
    Thanks received
    280
    Rep Power
    0
    Post the code...
    Reply With Quote  
     

  4. #4  
    Registered Member

    Join Date
    Sep 2010
    Posts
    1,248
    Thanks given
    536
    Thanks received
    179
    Rep Power
    106
    In PlayerAssistant.java you should have a method called "applyDead", post it here then give us the link.
    Reply With Quote  
     

  5. #5  
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    Quote Originally Posted by Kurdz View Post
    In PlayerAssistant.java you should have a method called "applyDead", post it here then give us the link.
    #8233072 - Pastie
    Reply With Quote  
     

  6. #6  
    Banned
    Join Date
    Jun 2013
    Posts
    205
    Thanks given
    93
    Thanks received
    28
    Rep Power
    0
    Can you post your inCC method as well please? Oh and are there any errors spammed in the cmd? That can help greatly
    Reply With Quote  
     

  7. #7  
    Banned

    Join Date
    Dec 2011
    Posts
    967
    Thanks given
    234
    Thanks received
    208
    Rep Power
    0
    Your HP probably gains slightly every second or so, basically make it stop regenerating if your respawntimer is > 0
    Reply With Quote  
     

  8. #8  
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    bump
    Reply With Quote  
     

  9. #9  
    Donator

    Join Date
    Jun 2012
    Posts
    637
    Thanks given
    129
    Thanks received
    87
    Rep Power
    57
    bump
    Reply With Quote  
     

  10. #10  
    Registered Member BryceTheCoder's Avatar
    Join Date
    Aug 2008
    Posts
    740
    Thanks given
    21
    Thanks received
    24
    Rep Power
    27
    Quote Originally Posted by Hi im 1 3 3 7 View Post
    So when a player gets 0 hp, and dies he still regenerates health, how can this be fixed?

    Code:
    		public void applyDead() {	
    		c.respawnTimer = 15;
    		c.isDead = false;
    
    		
    		
    		
    		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) {
    			    c.DC++;
                    o.KC++;
    				if (c.killerId != c.playerId)
    						
    
    				c.playerKilled = c.playerId;
    				if(o.duelStatus == 5) {
    					o.duelStatus++;
    				}
    if (c.inCC()) {
    	o.getItems().addItem(995, 10000000);
    	o.sendMessage("@blu@You receive 10m for killing "+c.playerName+"!");
    	Server.clanChat.sendTeamWarsMessage(c.clanId, c.playerName+" Has been killed in Team Wars.");
    }
    				if(!(c.npcIndex > 0) && c.inPits == false){
    				}
    				if (c.inWild() && !c.inFunPk() && !c.inCC())
    				if (Server.playerHandler.players[c.playerId].connectedFrom != o.lastKilled) {
    					o.sendMessage("You have defeated "+Misc.optimizeText(c.playerName)+"!");
    					o.sendMessage("and received 2 PvP Points!");     
    					o.pkPoints = (o.pkPoints + 2);
    					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.");
    						if (c.inFunPk())
    							c.sendMessage("You do not recieve PKP in FunPK");
    						return;
    					}
    			}
    			}
    		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;
    	}
    The problem is not in the applyDeath void.
    Its in your Client class and in your process void.

    Search for:
    Code:
    if (System.currentTimeMillis() - restoreStatsDelay
    You should see something around:
    Code:
    if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
    			restoreStatsDelay = System.currentTimeMillis();
    			for (int level = 0; level < playerLevel.length; level++) {
    				if (playerLevel[level] < getLevelForXP(playerXP[level])) {
    					if (level != 5) { // prayer doesn't restore
    						playerLevel[level] += 1;
    						getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
    						getPA().refreshSkill(level);
    					}
    				} else if (playerLevel[level] > getLevelForXP(playerXP[level])) {
    					playerLevel[level] -= 1;
    					getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
    					getPA().refreshSkill(level);
    				}
    			}
    		}
    You need to add something to say if he is dead then lets make sure he doesn't heal.
    Code:
    			if (respawnTimer != -6)
    				return;
    The respawnTimer will be -6 if you are alive. If you are not, it will not be -6.


    Should look like:

    Code:
    if (System.currentTimeMillis() - restoreStatsDelay > 60000) {
    			restoreStatsDelay = System.currentTimeMillis();
    			if (respawnTimer != -6)
    				return;
    			for (int level = 0; level < playerLevel.length; level++) {
    				if (playerLevel[level] < getLevelForXP(playerXP[level])) {
    					if (level != 5) { // prayer doesn't restore
    						playerLevel[level] += 1;
    						getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
    						getPA().refreshSkill(level);
    					}
    				} else if (playerLevel[level] > getLevelForXP(playerXP[level])) {
    					playerLevel[level] -= 1;
    					getPA().setSkillLevel(level, playerLevel[level], playerXP[level]);
    					getPA().refreshSkill(level);
    				}
    			}
    		}

    Advertise your RSPS cheap on my website: www.BryceBux.com

    ^ PM me and I will give you a few dollars for FREE on my website for advertisements ^
    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. Replies: 4
    Last Post: 08-06-2012, 04:54 PM
  2. Pk point when player dies? [PI]
    By ProjectAurora in forum Help
    Replies: 0
    Last Post: 11-19-2011, 07:09 PM
  3. Replies: 3
    Last Post: 08-22-2010, 02:12 AM
  4. Replies: 5
    Last Post: 08-15-2010, 02:51 AM
  5. Replies: 3
    Last Post: 04-11-2009, 12:40 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
  •