forked from UNLOZE/sm-plugins
entWatch4 update.
This commit is contained in:
@@ -5,8 +5,8 @@
|
||||
// Description: Handle the restrictions of [entWatch]
|
||||
//
|
||||
//====================================================================================================
|
||||
#include <smlib>
|
||||
#include <morecolors>
|
||||
#include <smlib>
|
||||
|
||||
#pragma newdecls required
|
||||
|
||||
@@ -20,14 +20,14 @@ Handle g_hFwd_OnClientRestricted;
|
||||
Handle g_hFwd_OnClientUnrestricted;
|
||||
|
||||
/* COOKIES */
|
||||
Handle g_hCookie_RestrictedIssued;
|
||||
Handle g_hCookie_RestrictedLength;
|
||||
Handle g_hCookie_RestrictedExpire;
|
||||
Handle g_hCookie_RestrictIssued;
|
||||
Handle g_hCookie_RestrictLength;
|
||||
Handle g_hCookie_RestrictExpire;
|
||||
|
||||
/* INTERGERS */
|
||||
int g_iRestrictedIssued[MAXPLAYERS+1];
|
||||
int g_iRestrictedLength[MAXPLAYERS+1];
|
||||
int g_iRestrictedExpire[MAXPLAYERS+1];
|
||||
int g_iRestrictIssued[MAXPLAYERS+1];
|
||||
int g_iRestrictLength[MAXPLAYERS+1];
|
||||
int g_iRestrictExpire[MAXPLAYERS+1];
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
@@ -64,9 +64,9 @@ public void OnPluginStart()
|
||||
g_hFwd_OnClientRestricted = CreateGlobalForward("EW_OnClientRestricted", ET_Ignore, Param_Cell, Param_Cell, Param_Cell);
|
||||
g_hFwd_OnClientUnrestricted = CreateGlobalForward("EW_OnClientUnrestricted", ET_Ignore, Param_Cell, Param_Cell);
|
||||
|
||||
g_hCookie_RestrictedIssued = RegClientCookie("EW_RestrictedIssued", "", CookieAccess_Private);
|
||||
g_hCookie_RestrictedLength = RegClientCookie("EW_RestrictedLength", "", CookieAccess_Private);
|
||||
g_hCookie_RestrictedExpire = RegClientCookie("EW_RestrictedExpire", "", CookieAccess_Private);
|
||||
g_hCookie_RestrictIssued = RegClientCookie("EW_RestrictIssued", "", CookieAccess_Private);
|
||||
g_hCookie_RestrictLength = RegClientCookie("EW_RestrictLength", "", CookieAccess_Private);
|
||||
g_hCookie_RestrictExpire = RegClientCookie("EW_RestrictExpire", "", CookieAccess_Private);
|
||||
|
||||
RegAdminCmd("sm_eban", Command_ClientRestrict, ADMFLAG_BAN);
|
||||
RegAdminCmd("sm_eunban", Command_ClientUnrestrict, ADMFLAG_UNBAN);
|
||||
@@ -77,9 +77,9 @@ public void OnPluginStart()
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientCookiesCached(int client)
|
||||
{
|
||||
g_iRestrictedIssued[client] = GetClientCookieInt(client, g_hCookie_RestrictedIssued);
|
||||
g_iRestrictedLength[client] = GetClientCookieInt(client, g_hCookie_RestrictedLength);
|
||||
g_iRestrictedExpire[client] = GetClientCookieInt(client, g_hCookie_RestrictedExpire);
|
||||
g_iRestrictIssued[client] = GetClientCookieInt(client, g_hCookie_RestrictIssued);
|
||||
g_iRestrictLength[client] = GetClientCookieInt(client, g_hCookie_RestrictLength);
|
||||
g_iRestrictExpire[client] = GetClientCookieInt(client, g_hCookie_RestrictExpire);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -87,9 +87,9 @@ public void OnClientCookiesCached(int client)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
g_iRestrictedIssued[client] = 0;
|
||||
g_iRestrictedLength[client] = 0;
|
||||
g_iRestrictedExpire[client] = 0;
|
||||
g_iRestrictIssued[client] = 0;
|
||||
g_iRestrictLength[client] = 0;
|
||||
g_iRestrictExpire[client] = 0;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -186,13 +186,13 @@ stock bool ClientRestrict(int client, int target, int length)
|
||||
int second = length * 60;
|
||||
int expire = issued + second;
|
||||
|
||||
g_iRestrictedIssued[target] = issued;
|
||||
g_iRestrictedLength[target] = length;
|
||||
g_iRestrictedExpire[target] = expire;
|
||||
g_iRestrictIssued[target] = issued;
|
||||
g_iRestrictLength[target] = length;
|
||||
g_iRestrictExpire[target] = expire;
|
||||
|
||||
SetClientCookieInt(target, g_hCookie_RestrictedIssued, issued);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictedLength, length);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictedExpire, expire);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictIssued, issued);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictLength, length);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictExpire, expire);
|
||||
|
||||
Call_StartForward(g_hFwd_OnClientRestricted);
|
||||
Call_PushCell(client);
|
||||
@@ -211,13 +211,13 @@ stock bool ClientUnrestrict(int client, int target)
|
||||
if (!Client_IsValid(client) || !Client_IsValid(target) || !AreClientCookiesCached(target) || !ClientRestricted(target))
|
||||
return false;
|
||||
|
||||
g_iRestrictedIssued[target] = 0;
|
||||
g_iRestrictedLength[target] = 0;
|
||||
g_iRestrictedExpire[target] = 0;
|
||||
g_iRestrictIssued[target] = 0;
|
||||
g_iRestrictLength[target] = 0;
|
||||
g_iRestrictExpire[target] = 0;
|
||||
|
||||
SetClientCookieInt(target, g_hCookie_RestrictedIssued, 0);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictedLength, 0);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictedExpire, 0);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictIssued, 0);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictLength, 0);
|
||||
SetClientCookieInt(target, g_hCookie_RestrictExpire, 0);
|
||||
|
||||
Call_StartForward(g_hFwd_OnClientUnrestricted);
|
||||
Call_PushCell(client);
|
||||
@@ -240,11 +240,11 @@ stock bool ClientRestricted(int client)
|
||||
return true;
|
||||
|
||||
//Permanent restriction..
|
||||
if (g_iRestrictedExpire[client] && g_iRestrictedLength[client] == 0)
|
||||
if (g_iRestrictExpire[client] && g_iRestrictLength[client] == 0)
|
||||
return true;
|
||||
|
||||
//Limited restriction..
|
||||
if (g_iRestrictedExpire[client] && g_iRestrictedExpire[client] >= GetTime())
|
||||
if (g_iRestrictExpire[client] && g_iRestrictExpire[client] >= GetTime())
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user