From 3dc480d564bdc6b280ab6504219ab84bdc3f0260 Mon Sep 17 00:00:00 2001 From: jenz Date: Mon, 16 Feb 2026 21:14:50 +0100 Subject: [PATCH] support for admin chat from stoat --- Discord_UNLOZE/scripting/Discord_UNLOZE.sp | 6 ++++ Discord_UNLOZE/scripting/live_chat_stoat.sp | 35 +++++++++++++++++++-- 2 files changed, 39 insertions(+), 2 deletions(-) diff --git a/Discord_UNLOZE/scripting/Discord_UNLOZE.sp b/Discord_UNLOZE/scripting/Discord_UNLOZE.sp index 9424d47..d4cc51f 100644 --- a/Discord_UNLOZE/scripting/Discord_UNLOZE.sp +++ b/Discord_UNLOZE/scripting/Discord_UNLOZE.sp @@ -669,6 +669,12 @@ public Action OnClientSayCommand(int client, const char[] sCommand, const char[] else Discord_POST(DISCORD_ADMINCHAT_WEBHOOKURL, sFinal, true, sUsername); + Call_StartForward(g_hForwardDiscord); + Call_PushString(sUsername); + Call_PushString(sFinal); + Call_PushCell(6); + Call_Finish(); + if (!bAdmin) { //g_iReplyTargetSerial = GetClientSerial(client); diff --git a/Discord_UNLOZE/scripting/live_chat_stoat.sp b/Discord_UNLOZE/scripting/live_chat_stoat.sp index cb9b8ce..101437a 100644 --- a/Discord_UNLOZE/scripting/live_chat_stoat.sp +++ b/Discord_UNLOZE/scripting/live_chat_stoat.sp @@ -21,8 +21,9 @@ public Plugin myinfo = public void OnPluginStart() { AddCommandListener(CommandListener_SmChat_stoat, "say"); - AddCommandListener(CommandListener_SmChat_stoat, "say_team"); - RegServerCmd("sm_printtoallchat_stoat", Command_PrintToAllChat_stoat, "Discord Integration"); + + RegServerCmd("sm_printtoallchat_stoat", Command_PrintToAllChat_stoat, "Stoat Integration"); + RegServerCmd("sm_printtoadminchat_stoat", Command_PrintToAdminChat_stoat, "Stoat Integration"); } public Action CommandListener_SmChat_stoat(int client, const char[] sCommand, int argc) @@ -95,6 +96,26 @@ public Action Command_PrintToAllChat_stoat(int args) return Plugin_Handled; } +public Action Command_PrintToAdminChat_stoat(int args) +{ + char sArgs[1024]; + char sArgs2[1024]; + + GetCmdArg(1, sArgs, sizeof(sArgs)); + GetCmdArg(2, sArgs2, sizeof(sArgs2)); + + for(int i = 0; i < MAXPLAYERS; i++) + { + if (IsValidClient(i)) + { + bool bAdmin = CheckCommandAccess(i, "", ADMFLAG_GENERIC, true); + if (bAdmin) + CPrintToChat(i, "{green}(Stoat ADMINS) %s: {yellow}%s", sArgs, sArgs2); + } + } + return Plugin_Handled; +} + public void GetDiscordToStoat(const char[] username, const char[] message, int type) { //type = 1. ADMINLOGS @@ -102,6 +123,7 @@ public void GetDiscordToStoat(const char[] username, const char[] message, int t //type = 3. AMDIN LOGS entwatch //type = 4. admin logs ze ban evasion //type = 5. Calladmin + //type = 6. admin chat ze if (type == 1) { SendToStoat(username, message, ""); @@ -122,4 +144,13 @@ public void GetDiscordToStoat(const char[] username, const char[] message, int t { SendToStoat(username, message, ""); } + else if(type == 6) + { + SendToStoat(username, message, ""); + } +} + +stock bool IsValidClient(int client) +{ + return (client > 0 && client <= MaxClients && IsClientInGame(client)); }