Originally Posted by
Hi im 1 3 3 7
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);
}
}
}