Fixed:
$saveKDR = true;
function GameConnection::loadKDR(%this) {
%fo = new fileObject();
%fo.openForRead("confifg/server/KDR/" @ %this.bl_id @ ".dat");
%this.kills = %fo.readLine();
%this.deaths = %fo.readLine();
%fo.close();
%fo.delete();
}
function GameConnection::saveKDR(%this) {
%fo = new fileObject();
%fo.openForWrite("confifg/server/KDR/" @ %this.bl_id @ ".dat");
%fo.writeLine(%this.kills);
%fo.writeLine(%this.deaths);
%fo.close();
%fo.delete();
}
function gameConnection::updateKDR(%this) {
%this.clanSuffix = %this.firstClanSuffix SPC "\c7[\c4" @ %this.getKDR() @ "\c7";
}
function gameConnection::getKDR(%this) {
return %this.kills - %this.deaths;
}
package KDR {
function GameConnection::autoAdminCheck(%this) {
if($saveKDR) {
%this.loadKDR();
%this.updateKDR();
}
return parent::autoAdminCheck(%this);
}
function gameConnection::onDeath(%this, %pl, %cl, %type, %loc) {
parent::onDeath(%this, %pl, %cl, %type, %loc);
if(%cl !$= %this)
%cl.kills++;
%this.deaths++;
%this.updateKDR();
if($saveKDR)
%this.saveKDR();
}
};
activatePackage(KDR);