From 265dfce9d7be1c9d438e309e0cc2518cec0b2324 Mon Sep 17 00:00:00 2001 From: zaCade Date: Sun, 9 Jul 2023 14:16:54 +0200 Subject: [PATCH] [Discord] Slight formatting and demo info. --- Discord_UNLOZE/scripting/Discord_UNLOZE.sp | 95 ++++++++++++---------- 1 file changed, 54 insertions(+), 41 deletions(-) diff --git a/Discord_UNLOZE/scripting/Discord_UNLOZE.sp b/Discord_UNLOZE/scripting/Discord_UNLOZE.sp index a6b97419..cf1f48e5 100644 --- a/Discord_UNLOZE/scripting/Discord_UNLOZE.sp +++ b/Discord_UNLOZE/scripting/Discord_UNLOZE.sp @@ -595,11 +595,11 @@ public Action OnLogAction(Handle hSource, Identity ident, int client, int target GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); if (IsDemoRecording()) - Format(sDemoInfo, sizeof(sDemoInfo), "[ Demo: %d @ Tick: %d ]", GetDemoRecordingNumber(), GetDemoRecordingTick()); + Format(sDemoInfo, sizeof(sDemoInfo), "Demo: %d @ Tick: %d", GetDemoRecordingNumber(), GetDemoRecordingTick()); else - Format(sDemoInfo, sizeof(sDemoInfo), "[ Not recording ]"); + Format(sDemoInfo, sizeof(sDemoInfo), "Not recording"); - Format(sFinal, sizeof(sFinal), "[ %s ]%s```%s```", sCurrentMap, sDemoInfo, sMsg); + Format(sFinal, sizeof(sFinal), "[ %s ][ %s ]```%s```", sCurrentMap, sDemoInfo, sMsg); GetClientName(client, sClientName, sizeof(sClientName)); @@ -769,7 +769,7 @@ public void CallAdmin_OnReportHandled(int client, int id) Discord_POST(DISCORD_CALLADMIN_WEBHOOKURL, sMessage, true, sUsername, false, "", false); } //' - +/* public Action Oryx_OnTrigger(int client, int &level, char[] cheat) { char sUsername[MAX_NAME_LENGTH]; @@ -790,18 +790,27 @@ public Action Oryx_OnTrigger(int client, int &level, char[] cheat) return Plugin_Continue; } - +*/ public void AntiBhopCheat_OnClientDetected(int client, char[] sReason, char[] sStats) { + char sCurrentMap[64]; + GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); + + char sDemoInfo[64]; + if (IsDemoRecording()) + Format(sDemoInfo, sizeof(sDemoInfo), "Demo: %d @ Tick: %d", GetDemoRecordingNumber(), GetDemoRecordingTick()); + else + Format(sDemoInfo, sizeof(sDemoInfo), "Not recording"); + + char sTrimmedStats[1792]; // 128 x 14 + strcopy(sTrimmedStats, sizeof(sTrimmedStats), sStats); + + char sMessage[1920]; // 128 x 15 + Format(sMessage, sizeof(sMessage), "[ %s ][ %s ]```%s\n%s```", sCurrentMap, sDemoInfo, sReason, sTrimmedStats); + char sUsername[MAX_NAME_LENGTH]; GetClientName(client, sUsername, sizeof(sUsername)); - char currentMap[64]; - GetCurrentMap(currentMap, sizeof(currentMap)); - - char sMessage[1900]; - Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s\n%s```", currentMap, GetGameTickCount(), sReason, sStats); - if (g_sAvatarURL[client][0] != '\0') Discord_POST(DISCORD_ANTIBHOPCHEAT_WEBHOOKURL, sMessage, true, sUsername, true, g_sAvatarURL[client], false); else @@ -810,30 +819,28 @@ public void AntiBhopCheat_OnClientDetected(int client, char[] sReason, char[] sS public void EW_OnClientRestricted(int client, int target, int length) { - char sUsername[MAX_NAME_LENGTH]; - GetClientName(target, sUsername, sizeof(sUsername)); + char sCurrentMap[64]; + GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); - char currentMap[64]; - GetCurrentMap(currentMap, sizeof(currentMap)); - - char sMessageTmp[1900]; - - if (length == -1) - { - Format(sMessageTmp, sizeof(sMessageTmp), "%L got temporarily restricted by %L", target, client); - } - else if (length == 0) - { - Format(sMessageTmp, sizeof(sMessageTmp), "%L got PERMANENTLY restricted by %L", target, client); - } + char sDemoInfo[64]; + if (IsDemoRecording()) + Format(sDemoInfo, sizeof(sDemoInfo), "Demo: %d @ Tick: %d", GetDemoRecordingNumber(), GetDemoRecordingTick()); else - { - Format(sMessageTmp, sizeof(sMessageTmp), "%L got restricted by %L for %d minutes", target, client, length); - } + Format(sDemoInfo, sizeof(sDemoInfo), "Not recording"); + char sMessageTemp[1280]; // 128 x 10 + if (length == -1) + Format(sMessageTemp, sizeof(sMessageTemp), "%L got temporarily restricted by %L", target, client); + else if (length == 0) + Format(sMessageTemp, sizeof(sMessageTemp), "%L got permanently restricted by %L", target, client); + else + Format(sMessageTemp, sizeof(sMessageTemp), "%L got restricted by %L for %d minutes", target, client, length); - char sMessage[1900]; - Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s```", currentMap, GetGameTickCount(), sMessageTmp); + char sMessage[1920]; // 128 x 15 + Format(sMessage, sizeof(sMessage), "[ %s ][ %s ]```%s```", sCurrentMap, sDemoInfo, sMessageTemp); + + char sUsername[MAX_NAME_LENGTH]; + GetClientName(client, sUsername, sizeof(sUsername)); if (g_sAvatarURL[target][0] != '\0') Discord_POST(DISCORD_ENTWATCH_WEBHOOKURL, sMessage, true, sUsername, true, g_sAvatarURL[target], false); @@ -844,17 +851,23 @@ public void EW_OnClientRestricted(int client, int target, int length) public void EW_OnClientUnrestricted(int client, int target) { + char sCurrentMap[64]; + GetCurrentMap(sCurrentMap, sizeof(sCurrentMap)); + + char sDemoInfo[64]; + if (IsDemoRecording()) + Format(sDemoInfo, sizeof(sDemoInfo), "Demo: %d @ Tick: %d", GetDemoRecordingNumber(), GetDemoRecordingTick()); + else + Format(sDemoInfo, sizeof(sDemoInfo), "Not recording"); + + char sMessageTemp[1280]; // 128 x 10 + Format(sMessageTemp, sizeof(sMessageTemp), "%L got unrestricted by %L", target, client); + + char sMessage[1920]; // 128 x 15 + Format(sMessage, sizeof(sMessage), "[ %s ][ %s ]```%s```", sCurrentMap, sDemoInfo, sMessageTemp); + char sUsername[MAX_NAME_LENGTH]; - GetClientName(target, sUsername, sizeof(sUsername)); - - char currentMap[64]; - GetCurrentMap(currentMap, sizeof(currentMap)); - - char sMessageTmp[1900]; - Format(sMessageTmp, sizeof(sMessageTmp), "%L got unrestricted by %L", target, client); - - char sMessage[1900]; - Format(sMessage, sizeof(sMessage), "```%s - Tick: %d``````%s```", currentMap, GetGameTickCount(), sMessageTmp); + GetClientName(client, sUsername, sizeof(sUsername)); if (g_sAvatarURL[target][0] != '\0') Discord_POST(DISCORD_ENTWATCH_WEBHOOKURL, sMessage, true, sUsername, true, g_sAvatarURL[target], false);