Actually add status command.
This commit is contained in:
parent
94bd0035f2
commit
dd2ef0992a
@ -218,11 +218,11 @@ public Action Command_DisplayRestrictions(int client, int args)
|
||||
char aBuf[1024];
|
||||
char aBuf2[MAX_NAME_LENGTH];
|
||||
|
||||
for(int i = 1; i <= MaxClients; i++)
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if(IsClientInGame(i) && !IsFakeClient(i))
|
||||
if (IsClientInGame(i) && !IsFakeClient(i))
|
||||
{
|
||||
if(ClientRestricted(i))
|
||||
if (ClientRestricted(i))
|
||||
{
|
||||
GetClientName(i, aBuf2, sizeof(aBuf2));
|
||||
StrCat(aBuf, sizeof(aBuf), aBuf2);
|
||||
@ -231,13 +231,13 @@ public Action Command_DisplayRestrictions(int client, int args)
|
||||
}
|
||||
}
|
||||
|
||||
if(strlen(aBuf))
|
||||
if (strlen(aBuf))
|
||||
{
|
||||
aBuf[strlen(aBuf) - 2] = 0;
|
||||
ReplyToCommand(client, "[SM] Currently restricted clients: %s", aBuf);
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sCurrently restricted clients: \x07%s%s", "E01B5D", "F16767", "EDEDED", aBuf);
|
||||
}
|
||||
else
|
||||
ReplyToCommand(client, "[SM] Currently restricted clients: none");
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sCurrently restricted clients: \x07%snone", "E01B5D", "F16767", "EDEDED");
|
||||
|
||||
return Plugin_Handled;
|
||||
}
|
||||
@ -247,7 +247,103 @@ public Action Command_DisplayRestrictions(int client, int args)
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action Command_DisplayStatus(int client, int args)
|
||||
{
|
||||
return Plugin_Handled;
|
||||
if (CheckCommandAccess(client, "", ADMFLAG_BAN) && GetCmdArgs())
|
||||
{
|
||||
char sArguments[1][32];
|
||||
GetCmdArg(1, sArguments[0], sizeof(sArguments[]));
|
||||
|
||||
int target;
|
||||
if ((target = FindTarget(client, sArguments[0], true)) == -1)
|
||||
return Plugin_Handled;
|
||||
|
||||
if (!AreClientCookiesCached(target))
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%s%N\x07%s their cookies are still loading.", "E01B5D", "EDEDED", target, "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else if (g_bRestrictedTemp[target])
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%s%N\x07%s is currently temporarily restricted.", "E01B5D", "EDEDED", target, "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else if (g_iRestrictIssued[target] && g_iRestrictExpire[target] == 0)
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%s%N\x07%s is currently permanently restricted.", "E01B5D", "EDEDED", target, "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else if (g_iRestrictIssued[target] && g_iRestrictExpire[target] >= GetTime())
|
||||
{
|
||||
char sTimeRemaining[32];
|
||||
int iTimeRemaining = g_iRestrictExpire[target] - GetTime();
|
||||
|
||||
int iDays = (iTimeRemaining / 86400);
|
||||
int iHours = (iTimeRemaining / 3600) % 24;
|
||||
int iMinutes = (iTimeRemaining / 60) % 60;
|
||||
int iSeconds = (iTimeRemaining % 60);
|
||||
|
||||
if (iDays)
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d:%02d:%02d:%02d", iDays, iHours, iMinutes, iSeconds);
|
||||
else if (iHours)
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d:%02d:%02d", iHours, iMinutes, iSeconds);
|
||||
else if (iMinutes)
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d:%02d", iMinutes, iSeconds);
|
||||
else
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d", iSeconds);
|
||||
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%s%N\x07%s is currently restricted for another: \x07%s%s\x07%s.", "E01B5D", "EDEDED", target, "F16767", "EDEDED", sTimeRemaining, "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%s%N\x07%s is currently not restricted.", "E01B5D", "EDEDED", target, "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AreClientCookiesCached(client))
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sYour cookies are still loading.", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else if (g_bRestrictedTemp[client])
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sYou are currently temporarily restricted.", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else if (g_iRestrictIssued[client] && g_iRestrictExpire[client] == 0)
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sYou are currently permanently restricted.", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else if (g_iRestrictIssued[client] && g_iRestrictExpire[client] >= GetTime())
|
||||
{
|
||||
char sTimeRemaining[32];
|
||||
int iTimeRemaining = g_iRestrictExpire[client] - GetTime();
|
||||
|
||||
int iDays = (iTimeRemaining / 86400);
|
||||
int iHours = (iTimeRemaining / 3600) % 24;
|
||||
int iMinutes = (iTimeRemaining / 60) % 60;
|
||||
int iSeconds = (iTimeRemaining % 60);
|
||||
|
||||
if (iDays)
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d:%02d:%02d:%02d", iDays, iHours, iMinutes, iSeconds);
|
||||
else if (iHours)
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d:%02d:%02d", iHours, iMinutes, iSeconds);
|
||||
else if (iMinutes)
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d:%02d", iMinutes, iSeconds);
|
||||
else
|
||||
Format(sTimeRemaining, sizeof(sTimeRemaining), "%d", iSeconds);
|
||||
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sYou are currently restricted for another: \x07%s%s\x07%s.", "E01B5D", "F16767", "EDEDED", sTimeRemaining, "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else
|
||||
{
|
||||
CReplyToCommand(client, "\x07%s[entWatch] \x07%sYou are currently not restricted.", "E01B5D", "F16767");
|
||||
return Plugin_Handled;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@ -352,7 +448,7 @@ stock bool ClientRestricted(int client)
|
||||
return true;
|
||||
|
||||
//Permanent restriction.
|
||||
if (g_iRestrictIssued[client] && g_iRestrictLength[client] == 0)
|
||||
if (g_iRestrictIssued[client] && g_iRestrictExpire[client] == 0)
|
||||
return true;
|
||||
|
||||
//Normal restriction.
|
||||
|
Loading…
Reference in New Issue
Block a user