2019-10-17 00:01:09 +02:00
# 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 )
{
2019-10-22 19:19:21 +02:00
int iLastReportID = CallAdmin_GetReportID ( ) ;
2019-10-17 00:01:09 +02:00
for ( int i = 1 ; i < = MaxClients ; i + + )
{
if ( IsClientInGame ( i ) & & ( CheckCommandAccess ( i , " " , ADMFLAG_GENERIC , true ) ) & & GetClientIdleTime ( i ) < g_iAdminAFKTime )
2019-10-22 19:19:21 +02:00
CPrintToChat ( i , " {green}[CALLADMIN] {lightgreen}%N reported %N for %s. Type {red}/calladmin_handle %d{lightgreen} in chat to handle this report. " , client , target , reason , iLastReportID + 1 ) ;
2019-10-17 00:01:09 +02:00
}
2019-10-22 19:19:21 +02:00
return Plugin_Continue ;
2019-10-17 00:01:09 +02:00
}