diff --git a/Discord_UNLOZE/scripting/live_chat_stoat.sp b/Discord_UNLOZE/scripting/live_chat_stoat.sp index 266b2a2..9fcc45a 100644 --- a/Discord_UNLOZE/scripting/live_chat_stoat.sp +++ b/Discord_UNLOZE/scripting/live_chat_stoat.sp @@ -5,6 +5,7 @@ #include #include #include +#include #define API_URL "" #define BOT_TOKEN "" @@ -17,7 +18,7 @@ public Plugin myinfo = name = "livechat stoat", author = "jenz", description = "", - version = "1.1.0", + version = "1.2.0", url = "www.unloze.com" } @@ -192,6 +193,49 @@ public Action Command_PrintToAdminChat_stoat(int args) return Plugin_Handled; } +//ai SLOP +void StripColorTags(char[] buffer, int maxlen) +{ + int len = strlen(buffer); + int writeIndex = 0; + bool inside = false; + + for (int i = 0; i < len; i++) + { + if (buffer[i] == '{') + { + inside = true; + continue; + } + else if (buffer[i] == '}') + { + inside = false; + continue; + } + + if (!inside && writeIndex < maxlen - 1) + { + buffer[writeIndex] = buffer[i]; + writeIndex++; + } + } + + buffer[writeIndex] = '\0'; +} + +public void GetPlayerConnectMessage(char[] message) +{ + StripColorTags(message, strlen(message)); + if (i_port == 27015) + { + SendToStoat("", message, ""); + } + else if (i_port == 27017) + { + SendToStoat("", message, ""); + } +} + public void GetDiscordToStoat(const char[] username, const char[] message, int type) { //type = 1. ADMINLOGS