diff --git a/CallAdmin/scripting/CallAdminRestrictions.sp b/CallAdmin/scripting/CallAdminRestrictions.sp index e814248f..7b0afbab 100644 --- a/CallAdmin/scripting/CallAdminRestrictions.sp +++ b/CallAdmin/scripting/CallAdminRestrictions.sp @@ -56,22 +56,13 @@ public Action CallAdmin_OnDrawTarget(int client, int target) //---------------------------------------------------------------------------------------------------- public Action CallAdmin_OnReportPre(int client, int target, const char[] reason) { - bool ActiveAdmins = false; + int iLastReportID = CallAdmin_GetReportID(); 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); - } + 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); } - if(ActiveAdmins) - { - CPrintToChat(client, "{green}[CALLADMIN] {lightgreen}Reported %N for %s.", target, reason); - return Plugin_Handled; - } - else - return Plugin_Continue; + return Plugin_Continue; } \ No newline at end of file diff --git a/Discord_UNLOZE/scripting/Discord_UNLOZE.sp b/Discord_UNLOZE/scripting/Discord_UNLOZE.sp index b1820b27..f95014eb 100644 --- a/Discord_UNLOZE/scripting/Discord_UNLOZE.sp +++ b/Discord_UNLOZE/scripting/Discord_UNLOZE.sp @@ -7,6 +7,7 @@ #include #include #include +#include #include #include @@ -39,6 +40,9 @@ int g_iRatelimitReset; int g_iLastReportID; +int g_iAdminAFKTime; +ConVar g_cvAdminAFKTime; + public Plugin myinfo = { name = "Discord core", @@ -110,6 +114,21 @@ public void OnPluginEnd() UnhookUserMessage(g_umSayText2, Hook_UserMessage, false); } +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); +} + +public void OnAdminAFKTimeChanged(ConVar convar, const char[] oldValue, const char[] newValue) +{ + g_iAdminAFKTime = g_cvAdminAFKTime.IntValue; +} + public void OnClientAuthorized(int client, const char[] sAuthID32) { if (IsFakeClient(client)) @@ -676,8 +695,21 @@ public void CallAdmin_OnReportPost(int client, int target, const char[] reason) char currentMap[64]; GetCurrentMap(currentMap, sizeof(currentMap)); + bool ActiveAdmins = false; + for (int i = 1; i <= MaxClients; i++) + { + if (IsClientInGame(i) && (CheckCommandAccess(i, "", ADMFLAG_GENERIC, true)) && GetClientIdleTime(i) < g_iAdminAFKTime) + { + ActiveAdmins = true; + break; + } + } + char sMessage[4096]; - Format(sMessage, sizeof(sMessage), "@here\n```%s - Tick: %d``````New report on server: %s (%s:%d)\nReportID: %d\nReporter: %s (%s)\nTarget: %s (%s)\nReason: %s\nJoin Server: steam://connect/%s:%d\nwhen in game, type !calladmin_handle %d or /calladmin_handle %d in chat to handle this report```", currentMap, GetGameTickCount(), sServerName, sServerIP, serverPort, g_iLastReportID, sClientName, sClientID, sTargetName, sTargetID, reason, sServerIP, serverPort, g_iLastReportID, g_iLastReportID); + if(ActiveAdmins) + Format(sMessage, sizeof(sMessage), "```***ACTIVE ADMINS IN-GAME***``````\n%s - Tick: %d``````New report on server: %s (%s:%d)\nReportID: %d\nReporter: %s (%s)\nTarget: %s (%s)\nReason: %s\nJoin Server: steam://connect/%s:%d\nwhen in game, type !calladmin_handle %d or /calladmin_handle %d in chat to handle this report```", currentMap, GetGameTickCount(), sServerName, sServerIP, serverPort, g_iLastReportID, sClientName, sClientID, sTargetName, sTargetID, reason, sServerIP, serverPort, g_iLastReportID, g_iLastReportID); + else + Format(sMessage, sizeof(sMessage), "@here ```***NO ACTIVE ADMINS IN-GAME***``````\n%s - Tick: %d``````New report on server: %s (%s:%d)\nReportID: %d\nReporter: %s (%s)\nTarget: %s (%s)\nReason: %s\nJoin Server: steam://connect/%s:%d\nwhen in game, type !calladmin_handle %d or /calladmin_handle %d in chat to handle this report```", currentMap, GetGameTickCount(), sServerName, sServerIP, serverPort, g_iLastReportID, sClientName, sClientID, sTargetName, sTargetID, reason, sServerIP, serverPort, g_iLastReportID, g_iLastReportID); char sUsername[MAX_NAME_LENGTH]; GetClientName(client, sUsername, sizeof(sUsername));