CallAdmin: ready to go
added feature where message to discord is blocked if active admins are in-game
This commit is contained in:
parent
77968e36c1
commit
ff4daeab8c
@ -348,7 +348,7 @@ public void OnPluginStart()
|
||||
g_hConfirmCall = AutoExecConfig_CreateConVar("sm_calladmin_confirm_call", "1", "Whether or not a call must be confirmed by the client", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hSpamTime = AutoExecConfig_CreateConVar("sm_calladmin_spamtime", "25", "An user must wait this many seconds after a report before he can issue a new one", FCVAR_NONE, true, 0.0);
|
||||
g_hReportTime = AutoExecConfig_CreateConVar("sm_calladmin_reporttime", "300", "An user cannot be reported again for this many seconds", FCVAR_NONE, true, 0.0);
|
||||
g_hAdminAction = AutoExecConfig_CreateConVar("sm_calladmin_admin_action", "1", "What happens when admins are in-game on report: 0 - Do nothing, let the report pass, 1 - Block the report and notify the caller and admins in-game about it", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
g_hAdminAction = AutoExecConfig_CreateConVar("sm_calladmin_admin_action", "0", "What happens when admins are in-game on report: 0 - Do nothing, let the report pass, 1 - Block the report and notify the caller and admins in-game about it", FCVAR_NONE, true, 0.0, true, 1.0);
|
||||
|
||||
|
||||
|
77
CallAdmin/scripting/CallAdminRestrictions.sp
Normal file
77
CallAdmin/scripting/CallAdminRestrictions.sp
Normal file
@ -0,0 +1,77 @@
|
||||
#include <sourcemod>
|
||||
#include <calladmin>
|
||||
#include <basecomm>
|
||||
#include <AFKManager>
|
||||
#include <multicolors>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
int g_iAdminAFKTime;
|
||||
ConVar g_cvAdminAFKTime;
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "CallAdmin Restrictions",
|
||||
author = "Neon + Dogan",
|
||||
description = "",
|
||||
version = "2.0",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnAllPluginsLoaded()
|
||||
{
|
||||
if((g_cvAdminAFKTime = FindConVar("sm_admin_afk_time")) == INVALID_HANDLE)
|
||||
SetFailState("Failed to find sm_admin_afk_time cvar.");
|
||||
else
|
||||
g_iAdminAFKTime = g_cvAdminAFKTime.IntValue;
|
||||
|
||||
HookConVarChange(g_cvAdminAFKTime, OnAdminAFKTimeChanged);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public void OnAdminAFKTimeChanged(ConVar convar, const char[] oldValue, const char[] newValue)
|
||||
{
|
||||
g_iAdminAFKTime = g_cvAdminAFKTime.IntValue;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action CallAdmin_OnDrawTarget(int client, int target)
|
||||
{
|
||||
if (CheckCommandAccess(target, "", ADMFLAG_GENERIC, true))
|
||||
return Plugin_Handled;
|
||||
else
|
||||
return Plugin_Continue;
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action CallAdmin_OnReportPre(int client, int target, const char[] reason)
|
||||
{
|
||||
bool ActiveAdmins = false;
|
||||
|
||||
for (int i = 1; i <= MaxClients; i++)
|
||||
{
|
||||
if (IsClientInGame(i) && (CheckCommandAccess(i, "", ADMFLAG_GENERIC, true)) && GetClientIdleTime(i) < g_iAdminAFKTime)
|
||||
{
|
||||
ActiveAdmins = true;
|
||||
CPrintToChat(i, "{green}[CALLADMIN] {lightgreen}%N reported %N for %s.", client, target, reason);
|
||||
}
|
||||
}
|
||||
|
||||
if(ActiveAdmins)
|
||||
{
|
||||
CPrintToChat(client, "{green}[CALLADMIN] {lightgreen}Reported %N for %s.", target, client);
|
||||
return Plugin_Handled;
|
||||
}
|
||||
else
|
||||
return Plugin_Continue;
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
#include <sourcemod>
|
||||
#include <calladmin>
|
||||
#include <basecomm>
|
||||
|
||||
#pragma semicolon 1
|
||||
#pragma newdecls required
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
name = "CallAdmin Restrictions",
|
||||
author = "Neon",
|
||||
description = "",
|
||||
version = "1.0",
|
||||
url = "https://steamcommunity.com/id/n3ontm"
|
||||
};
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
// Purpose:
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
public Action CallAdmin_OnDrawTarget(int client, int target)
|
||||
{
|
||||
if (CheckCommandAccess(target, "", ADMFLAG_GENERIC, true))
|
||||
return Plugin_Handled;
|
||||
else
|
||||
return Plugin_Continue;
|
||||
}
|
1
includes/autoexecconfig.inc
Normal file
1
includes/autoexecconfig.inc
Normal file
@ -0,0 +1 @@
|
||||
../CallAdmin/scripting/include/autoexecconfig.inc
|
1
includes/calladmin.inc
Normal file
1
includes/calladmin.inc
Normal file
@ -0,0 +1 @@
|
||||
../CallAdmin/scripting/include/calladmin.inc
|
1
includes/calladmin_stocks.inc
Normal file
1
includes/calladmin_stocks.inc
Normal file
@ -0,0 +1 @@
|
||||
../CallAdmin/scripting/include/calladmin_stocks.inc
|
1
includes/calladmin_usermanager.inc
Normal file
1
includes/calladmin_usermanager.inc
Normal file
@ -0,0 +1 @@
|
||||
../CallAdmin/scripting/include/calladmin_usermanager.inc
|
Loading…
Reference in New Issue
Block a user