40 lines
1.1 KiB
Plaintext
40 lines
1.1 KiB
Plaintext
//:://////////////////////////////////////////////
|
|
//:: Name: OnPlayerDying
|
|
//:: FileName: js_onplayerdying
|
|
//:://////////////////////////////////////////////
|
|
/*
|
|
Sets the local int to tell the Module that a
|
|
PC is hurt/dying and calls that to another int
|
|
in case they log off.
|
|
Props to 'spilth" for his excellent tutorial.
|
|
*/
|
|
//:://////////////////////////////////////////////
|
|
//:: Created By: SPBTooL
|
|
//:: Modified By: Jer Wolfe
|
|
//:: Created On:
|
|
//:://////////////////////////////////////////////
|
|
#include "js_include"
|
|
|
|
void main()
|
|
{
|
|
object oPC = GetLastPlayerDying();
|
|
// Let the module know somebody is not alive
|
|
object oModule = GetModule();
|
|
int iPCHealth = GetLocalInt(oPC, "PCHealth");
|
|
SetLocalInt(oModule, "PCAlive", FALSE);
|
|
SetLocalInt(oPC, "PCHealth", PC_HEALTH_DYING);
|
|
// Check if they stablized, disconnected and then reconnected...
|
|
|
|
if ((iPCHealth != PC_HEALTH_DEAD) && (GetCurrentHitPoints(oPC) <= -10))
|
|
{
|
|
SetLocalInt(oPC, "PCHealth", PC_HEALTH_DEAD);
|
|
SetLocalInt(oPC, "LastHitPoints", GetCurrentHitPoints(oPC));
|
|
}
|
|
else
|
|
{
|
|
// OnHeartbeat
|
|
}
|
|
|
|
}
|
|
|