[AFKManager] Disable during breaks.
This commit is contained in:
parent
1bef3d168e
commit
8a213d5881
@ -4,6 +4,7 @@
|
|||||||
#include <AFKManager>
|
#include <AFKManager>
|
||||||
|
|
||||||
#undef REQUIRE_PLUGIN
|
#undef REQUIRE_PLUGIN
|
||||||
|
#include <Break>
|
||||||
#include <zombiereloaded>
|
#include <zombiereloaded>
|
||||||
#define REQUIRE_PLUGIN
|
#define REQUIRE_PLUGIN
|
||||||
|
|
||||||
@ -12,6 +13,8 @@
|
|||||||
|
|
||||||
#define AFK_CHECK_INTERVAL 5.0
|
#define AFK_CHECK_INTERVAL 5.0
|
||||||
|
|
||||||
|
bool g_Plugin_Break;
|
||||||
|
|
||||||
bool g_Players_bEnabled[MAXPLAYERS + 1];
|
bool g_Players_bEnabled[MAXPLAYERS + 1];
|
||||||
bool g_Players_bFlagged[MAXPLAYERS + 1];
|
bool g_Players_bFlagged[MAXPLAYERS + 1];
|
||||||
int g_Players_iLastAction[MAXPLAYERS + 1];
|
int g_Players_iLastAction[MAXPLAYERS + 1];
|
||||||
@ -112,6 +115,26 @@ public APLRes AskPluginLoad2(Handle myself, bool late, char[] error, int err_max
|
|||||||
return APLRes_Success;
|
return APLRes_Success;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void OnAllPluginsLoaded()
|
||||||
|
{
|
||||||
|
g_Plugin_Break = LibraryExists("Break");
|
||||||
|
|
||||||
|
LogMessage("AFKManager capabilities:\nBreak: %s",
|
||||||
|
(g_Plugin_Break ? "loaded" : "not loaded"));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnLibraryAdded(const char[] name)
|
||||||
|
{
|
||||||
|
if(StrEqual(name, "Break"))
|
||||||
|
g_Plugin_Break = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnLibraryRemoved(const char[] name)
|
||||||
|
{
|
||||||
|
if(StrEqual(name, "Break"))
|
||||||
|
g_Plugin_Break = false;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnMapStart()
|
public void OnMapStart()
|
||||||
{
|
{
|
||||||
CreateTimer(AFK_CHECK_INTERVAL, Timer_CheckPlayer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
CreateTimer(AFK_CHECK_INTERVAL, Timer_CheckPlayer, _, TIMER_REPEAT|TIMER_FLAG_NO_MAPCHANGE);
|
||||||
@ -128,6 +151,41 @@ public void OnMapStart()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Break_OnBreakStarted()
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientConnected(i))
|
||||||
|
OnClientConnected(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Break_OnBreakCancelled()
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientConnected(i))
|
||||||
|
{
|
||||||
|
OnClientConnected(i);
|
||||||
|
if(IsClientInGame(i) && IsClientAuthorized(i))
|
||||||
|
OnClientPostAdminCheck(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Break_OnBreakFinished()
|
||||||
|
{
|
||||||
|
for(int i = 1; i <= MaxClients; i++)
|
||||||
|
{
|
||||||
|
if(IsClientConnected(i))
|
||||||
|
{
|
||||||
|
OnClientConnected(i);
|
||||||
|
if(IsClientInGame(i) && IsClientAuthorized(i))
|
||||||
|
OnClientPostAdminCheck(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void OnClientConnected(int client)
|
public void OnClientConnected(int client)
|
||||||
{
|
{
|
||||||
ResetPlayer(client);
|
ResetPlayer(client);
|
||||||
@ -135,6 +193,9 @@ public void OnClientConnected(int client)
|
|||||||
|
|
||||||
public void OnClientPostAdminCheck(int client)
|
public void OnClientPostAdminCheck(int client)
|
||||||
{
|
{
|
||||||
|
if(g_Plugin_Break && Break_IsBreakActive())
|
||||||
|
return;
|
||||||
|
|
||||||
if(!IsFakeClient(client))
|
if(!IsFakeClient(client))
|
||||||
InitializePlayer(client);
|
InitializePlayer(client);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user