From 60a5c306510ff94a14644bfca0b4dcb5a2dde167 Mon Sep 17 00:00:00 2001 From: gsd Date: Tue, 4 Jun 2024 19:36:33 +0300 Subject: [PATCH] report hype v5 --- ext/sourcepawn-client/Facti13Reports.sp | 78 +++++++++++++++++-------- 1 file changed, 54 insertions(+), 24 deletions(-) diff --git a/ext/sourcepawn-client/Facti13Reports.sp b/ext/sourcepawn-client/Facti13Reports.sp index e832cbe..f0dbacc 100644 --- a/ext/sourcepawn-client/Facti13Reports.sp +++ b/ext/sourcepawn-client/Facti13Reports.sp @@ -20,7 +20,7 @@ bool g_clients_reasons_wait[MAXPLAYERS+1]; char g_clients_reason[MAXPLAYERS+1][REASON_TEXT_SIZE]; // Plugin Vars -int g_client_cooldown; +int g_client_cooldown = 300; // Choices #define REASONS_SLOTS 32 @@ -29,6 +29,7 @@ int g_reasons_bitflag[REASONS_SLOTS]; char g_reasons_solution[REASONS_SLOTS][REASON_TEXT_SIZE]; public OnPluginStart() { + fillReason(); SetupGlobalConVar(); SetupThis(); } @@ -37,6 +38,48 @@ public OnPluginEnd() { UnSetupGlobalConvar(); } +stock fillReason() { + char EMBEDED_REASONS[REASONS_SLOTS][REASON_TEXT_SIZE]; + Format(EMBEDED_REASONS[0], REASON_TEXT_SIZE, "Аdmin абуз :)|z"); + Format(EMBEDED_REASONS[1], REASON_TEXT_SIZE, "Аdmin абуз|b"); + Format(EMBEDED_REASONS[2], REASON_TEXT_SIZE, "Moder абуз|k"); + Format(EMBEDED_REASONS[3], REASON_TEXT_SIZE, "FreeVIP абуз|t|Ты можешь проголосовать за кик данного игрока из меню. Введи для этого в чат: меню, потом иди по пути: меню -> голосование -> кикнуть"); + Format(EMBEDED_REASONS[4], REASON_TEXT_SIZE, "VIP абуз|a|Ты можешь проголосовать за кик данного игрока из меню. Введи для этого в чат: меню, потом иди по пути: меню -> голосование -> кикнуть"); + Format(EMBEDED_REASONS[5], REASON_TEXT_SIZE, "Читы"); + Format(EMBEDED_REASONS[6], REASON_TEXT_SIZE, "Микспам||Ты можешь проголосовать чтоб данного игрока заглушили. Введи для этого в чат: меню, потом иди по пути: меню -> голосование -> замьютить"); + Format(EMBEDED_REASONS[7], REASON_TEXT_SIZE, "Трейдер"); + Format(EMBEDED_REASONS[8], REASON_TEXT_SIZE, "Тупые опросы||Ты можешь проголосовать чтоб у данного игрока выключили голосование. Введи для этого в чат: меню, потом иди по пути: меню -> голосование -> блокировка команд -> голосование"); + Format(EMBEDED_REASONS[9], REASON_TEXT_SIZE, "Реклама"); + Format(EMBEDED_REASONS[10], REASON_TEXT_SIZE, "Скаммер"); + Format(EMBEDED_REASONS[11], REASON_TEXT_SIZE, "Путис"); + Format(EMBEDED_REASONS[12], REASON_TEXT_SIZE, "Женщина на сервере"); + + int i_counter = 0; + char multi_container[3][REASON_TEXT_SIZE]; + char single_container[CONFIG_REASON_LINE]; + + for (i_counter = 0; i_counter < REASONS_SLOTS; i_counter++){ + multi_container[0][0] = '\0'; + multi_container[1][0] = '\0'; + multi_container[2][0] = '\0'; + single_container[0] = '\0'; + + Format(single_container, CONFIG_REASON_LINE, EMBEDED_REASONS[i_counter]); + + if(strlen(single_container) > 0){ + ExplodeString(single_container, "|", multi_container, 3, REASON_TEXT_SIZE) + Format(g_reasons[i_counter], sizeof(g_reasons[]), "%s", multi_container[0]); + g_reasons_bitflag[i_counter] = ReadFlagString(multi_container[1][0]); + Format(g_reasons_solution[i_counter], sizeof(g_reasons_solution[]), "%s", multi_container[2]); + } else { + g_reasons[i_counter][0] = '\0'; + g_reasons_bitflag[i_counter] = 0; + g_reasons_solution[i_counter][0] = '\0'; + } + //g_reasons[i_counter] + } +} + public SetupThis(){ RegConsoleCmd("sm_report2", COMMAND_ClientReport); ///////////////////////////////////////////////////////////////// @@ -59,9 +102,9 @@ stock HTTPRequest createRequest() { HTTPRequest client = INVALID_HANDLE; char url[256]; Format(url, sizeof(url), "%s/report", g_url); - - if (strlen(g_url)>0) { - client = new HTTPRequest(g_url); + LogMessage("Use report endpoint: %s", url); + if (strlen(url)>0) { + client = new HTTPRequest(url); client.SetHeader("Cookie", g_cookie); client.Timeout = 3; } else { @@ -74,17 +117,21 @@ stock HTTPRequest createRequest() { static void SendReport(const char[] reason, int uid){ int cid_author = GetClientOfUserId(uid); int cid_reported = GetClientOfUserId(g_clients_reported_uid[cid_author]); + LogMessage("author: %N, reported: %N", cid_author, cid_reported); char author_steam64[64]; char reported_steam64[64]; GetClientAuthId(cid_author, AuthId_SteamID64, author_steam64, 64); - GetClientAuthId(cid_reported, AuthId_SteamID64, reported_steam64, 64); + if (cid_reported != 0) + GetClientAuthId(cid_reported, AuthId_SteamID64, reported_steam64, 64); JSONObject payload = new JSONObject(); payload.SetString("author_steam64", author_steam64); - payload.SetString("reported_steam64", reported_steam64); payload.SetString("reason", reason); + if (cid_reported != 0) + payload.SetString("reported_steam64", reported_steam64); + createRequest().Post(payload, Report_Callback, uid); //////////////////////////////////////////////////////////////// @@ -190,24 +237,6 @@ public int DisplayReasons(int cid){ } else { AddMenuItem(ReasonsMenu, menu_item, g_reasons[i]); } - /*if(StrContains(g_reasons[i], "|") != -1){ - if(HavePermitionReason){ - continue; - } - - if(g_reasons_bitflag != 0){ - if(CheckCommandAccess(cid, "", )) - } - //char container[3][256]; - //ExplodeString(g_reasons[i],"|",container, 2, 64); - //int flag = (1<", "Меню"); @@ -308,6 +337,7 @@ public int SelectPlayerHandle(Handle ReportMenu, MenuAction eAction, int cid, in return; } + LogMessage("Fill reported uid, author: %N, reported: %N", cid, reported_cid); g_clients_reported_uid[cid] = GetClientUserId(reported_cid); DisplayReasons(cid);