
OnClientLeave :
Code: Select all
void main(){
object oPlayer = GetExitingObject();
int iLeavingPlayerHP = GetCurrentHitPoints(oPlayer);
string sHPString = GetName(oPlayer) + "_Health";
string sLogDeath = GetName(oPlayer) + "_LogDeath";
SetLocalInt(GetModule(), sHPString, iLeavingPlayerHP);
if(iLeavingPlayerHP <= 0){
SetLocalInt(GetModule(), sLogDeath, GetLocalInt(GetModule(), sLogDeath) + 1);
WriteTimestampedLogEntry("****** Player " + GetName(oPlayer) + " has logged out while dying. This was attempted " + IntToString(GetLocalInt(GetModule(), sLogDeath)) + " time(s) during this session.");
}
}
OnClientEnter :
Code: Select all
int CheckHealth(object oPlayer){
int iDamage = 0;
string sLogString = GetName(oPlayer) + "_Relogged";
string sHPString = GetName(oPlayer) + "_Health";
string sLogDeath = GetName(oPlayer) + "_LogDeath";
if(GetLocalInt(GetModule(), sLogString)){
iDamage = GetMaxHitPoints(oPlayer) - GetLocalInt(GetModule(), sHPString);
SendMessageToPC(oPlayer, "You last logged out with " + IntToString(GetLocalInt(GetModule(), sHPString)) + " remaining hitpoints.");
SendMessageToPC(oPlayer, "You logged off " + IntToString(GetLocalInt(GetModule(), sLogDeath)) + " time(s) to prevent death.");
SendMessageToAllDMs(GetName(oPlayer) + " logged off " + IntToString(GetLocalInt(GetModule(), sLogDeath)) + " time(s) to prevent death.");
}
else
SetLocalInt(GetModule(), sLogString, 1);
return iDamage;
}
void main(){
object oPlayer = GetEnteringObject();
SetPlotFlag(oPlayer, FALSE);
ApplyEffectToObject(DURATION_TYPE_INSTANT, EffectDamage(CheckHealth(oPlayer)), oPlayer);
}