Initial Upload
Initial Upload
This commit is contained in:
86
_module/nss/bx_afkbooter.nss
Normal file
86
_module/nss/bx_afkbooter.nss
Normal file
@@ -0,0 +1,86 @@
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
// bx_afkbooter //
|
||||
// //
|
||||
//This script detects PC that has been afk about 10 minutes and then boots them.//
|
||||
//It uses location of the PC, but restarts if the PC is/has dead, levelled up, //
|
||||
//acquared/unacquared an item or equiped an item. //
|
||||
//This script is included in module event OnClientEnter named sp_cliententer. //
|
||||
//Important parts of this script is also in sp_acquire_item, unacquire_item and //
|
||||
//elv_onitemequip. //
|
||||
// //
|
||||
//Ba'alzamon //
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
void main()
|
||||
{
|
||||
location lCheck = GetLocation(OBJECT_SELF);
|
||||
location lStart;
|
||||
location lAgain;
|
||||
int nLevel = GetLevelByPosition(1) + GetLevelByPosition(2) + GetLevelByPosition(3);
|
||||
object oArea = GetArea(OBJECT_SELF);
|
||||
string sArea = GetTag(oArea);
|
||||
|
||||
int nStart = GetLocalInt(OBJECT_SELF, "AFK_I_Detecter");
|
||||
int nLvlCheck = GetLocalInt(OBJECT_SELF, "AFK_lvl_Detecter");
|
||||
if(nStart == FALSE)
|
||||
{
|
||||
SetLocalLocation(OBJECT_SELF, "AFK_L_Detecter", lCheck);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_I_Detecter", 1);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_lvl_Detecter", nLevel);
|
||||
DelayCommand(300.0f, ExecuteScript("bx_afkbooter", OBJECT_SELF));
|
||||
}
|
||||
else if(nStart == 1)
|
||||
{
|
||||
lStart = GetLocalLocation(OBJECT_SELF, "AFK_L_Detecter");
|
||||
if(lStart == lCheck && !GetIsDead(OBJECT_SELF) && nLvlCheck == nLevel)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "AFK_I_Detecter", 2);
|
||||
DelayCommand(150.0f, ExecuteScript("bx_afkbooter", OBJECT_SELF));
|
||||
SendMessageToPC(OBJECT_SELF, "You seem to have been afk for over 5 minutes. You will be booted if you don't start playing in 5 minutes.");
|
||||
}
|
||||
else
|
||||
{
|
||||
lAgain = GetLocation(OBJECT_SELF);
|
||||
SetLocalLocation(OBJECT_SELF, "AFK_L_Detecter", lAgain);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_lvl_Detecter", nLevel);
|
||||
DelayCommand(300.0f, ExecuteScript("bx_afkbooter", OBJECT_SELF));
|
||||
}
|
||||
}
|
||||
else if(nStart == 2)
|
||||
{
|
||||
lStart = GetLocalLocation(OBJECT_SELF, "AFK_L_Detecter");
|
||||
if(lStart == lCheck && !GetIsDead(OBJECT_SELF) && nLvlCheck == nLevel)
|
||||
{
|
||||
SetLocalInt(OBJECT_SELF, "AFK_I_Detecter", 3);
|
||||
DelayCommand(150.0f, ExecuteScript("bx_afkbooter", OBJECT_SELF));
|
||||
SendMessageToPC(OBJECT_SELF, "You seem to have been afk for over 7,5 minutes. You will be booted if you don't start playing in 2,5 minutes.");
|
||||
}
|
||||
else
|
||||
{
|
||||
lAgain = GetLocation(OBJECT_SELF);
|
||||
SetLocalLocation(OBJECT_SELF, "AFK_L_Detecter", lAgain);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_I_Detecter", 1);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_lvl_Detecter", nLevel);
|
||||
DelayCommand(300.0f, ExecuteScript("bx_afkbooter", OBJECT_SELF));
|
||||
}
|
||||
}
|
||||
else if(nStart == 3)
|
||||
{
|
||||
lStart = GetLocalLocation(OBJECT_SELF, "AFK_L_Detecter");
|
||||
if(lStart == lCheck && !GetIsDead(OBJECT_SELF) && nLvlCheck == nLevel)
|
||||
{
|
||||
DeleteLocalInt(OBJECT_SELF, "AFK_I_Detecter");
|
||||
DeleteLocalLocation(OBJECT_SELF, "AFK_L_Detecter");
|
||||
SendMessageToPC(OBJECT_SELF, "You will be booted for being afk over 10 minutes... You can log back in whenever you want.");
|
||||
DelayCommand(10.0f, SendMessageToAllDMs("Booted " + GetPCPlayerName(OBJECT_SELF) + " for being afk over 10 minutes."));
|
||||
DelayCommand(10.0f, BootPC(OBJECT_SELF));
|
||||
}
|
||||
else
|
||||
{
|
||||
lAgain = GetLocation(OBJECT_SELF);
|
||||
SetLocalLocation(OBJECT_SELF, "AFK_L_Detecter", lAgain);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_I_Detecter", 1);
|
||||
SetLocalInt(OBJECT_SELF, "AFK_lvl_Detecter", nLevel);
|
||||
DelayCommand(300.0f, ExecuteScript("bx_afkbooter", OBJECT_SELF));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user