From d80a354e18d5735d888958ec369dc8955600602e Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 16 Mar 2021 11:30:46 +0100 Subject: [PATCH] super simple queries for retired and mappers --- .../UNLOZE_ForumIntegration.sp | 90 ++++++++++++++++++- 1 file changed, 87 insertions(+), 3 deletions(-) diff --git a/_UNLOZE_ForumIntegration_MYSQL/UNLOZE_ForumIntegration.sp b/_UNLOZE_ForumIntegration_MYSQL/UNLOZE_ForumIntegration.sp index 881abf9a..42f6371e 100644 --- a/_UNLOZE_ForumIntegration_MYSQL/UNLOZE_ForumIntegration.sp +++ b/_UNLOZE_ForumIntegration_MYSQL/UNLOZE_ForumIntegration.sp @@ -180,7 +180,7 @@ public void SQL_FUCKYOU(Database db, DBResultSet results, const char[] error, in { int client; if ((client = GetClientFromSerial(data)) == 0) - return; + return; if (results.RowCount && results.FetchRow()) { @@ -188,6 +188,52 @@ public void SQL_FUCKYOU(Database db, DBResultSet results, const char[] error, in } else { + char sSID[32]; + GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); + char sSteamID64[32]; + SteamID32toSteamID64(sSID, sSteamID64, sizeof(sSteamID64)); + char sRequest[256]; + Format(sRequest, sizeof(sRequest), "select * from unloze_forum.xf_user xfu inner join unloze_forum.xf_user_external_auth xuea ON xfu.user_id = xuea.user_id where find_in_set('6',secondary_group_ids) <> 0 and provider_key = '%s'", sSteamID64); + g_hDatabase.Query(SQL_FUCKYOU_mapper, sRequest, GetClientSerial(client)); + } +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void SQL_FUCKYOU_mapper(Database db, DBResultSet results, const char[] error, int data) +{ + int client; + if ((client = GetClientFromSerial(data)) == 0) + return; + + if (results.RowCount && results.FetchRow()) + { + OnClientAuthorized_OnTransferResponse("Game-Donator", data); + } + else + { + char sSID[32]; + GetClientAuthId(client, AuthId_Steam2, sSID, sizeof(sSID)); + char sSteamID64[32]; + SteamID32toSteamID64(sSID, sSteamID64, sizeof(sSteamID64)); + char sRequest[256]; + Format(sRequest, sizeof(sRequest), "select * from unloze_forum.xf_user xfu inner join unloze_forum.xf_user_external_auth xuea ON xfu.user_id = xuea.user_id where find_in_set('21',secondary_group_ids) <> 0 and provider_key = '%s'", sSteamID64); + g_hDatabase.Query(SQL_FUCKYOU_retired, sRequest, GetClientSerial(client)); + } +} + +//---------------------------------------------------------------------------------------------------- +// Purpose: +//---------------------------------------------------------------------------------------------------- +public void SQL_FUCKYOU_retired(Database db, DBResultSet results, const char[] error, int data) +{ + if (results.RowCount && results.FetchRow()) + { + OnClientAuthorized_OnTransferResponse("Game-Donator", data); + } + else + { OnClientAuthorized_OnTransferResponse("NOGROUP", data); } } @@ -205,7 +251,7 @@ public int OnClientAuthorized_OnTransferResponse(char[] sData, int iSerial) TrimString(sData); StripQuotes(sData); - LogMessage("reached sData with status 200: %s", sData); + //LogMessage("reached sData with status 200: %s", sData); strcopy(G_sGroup[client], sizeof(G_sGroup[]), sData); G_bResponsePassed[client] = true; @@ -305,6 +351,44 @@ public void SQL_FUCKYOU2(Database db, DBResultSet results, const char[] error, D } else { + char sSID[32]; + ResetPack(fuck); + fuck.ReadString(sSID, sizeof(sSID)); + char sSteamID64[32]; + SteamID32toSteamID64(sSID, sSteamID64, sizeof(sSteamID64)); + char sRequest[256]; + Format(sRequest, sizeof(sRequest), "select * from unloze_forum.xf_user xfu inner join unloze_forum.xf_user_external_auth xuea ON xfu.user_id = xuea.user_id where find_in_set('6',secondary_group_ids) <> 0 and provider_key = '%s'", sSteamID64); + g_hDatabase.Query(SQL_FUCKYOU_mapper2, sRequest, fuck); + } +} + +public void SQL_FUCKYOU_mapper2(Database db, DBResultSet results, const char[] error, DataPack fuck) +{ + if (results.RowCount && results.FetchRow()) + { + Native_AsyncHasSteamIDReservedSlot_OnTransferResponse("Game-Donator", fuck); + } + else + { + char sSID[32]; + ResetPack(fuck); + fuck.ReadString(sSID, sizeof(sSID)); + char sSteamID64[32]; + SteamID32toSteamID64(sSID, sSteamID64, sizeof(sSteamID64)); + char sRequest[256]; + Format(sRequest, sizeof(sRequest), "select * from unloze_forum.xf_user xfu inner join unloze_forum.xf_user_external_auth xuea ON xfu.user_id = xuea.user_id where find_in_set('21',secondary_group_ids) <> 0 and provider_key = '%s'", sSteamID64); + g_hDatabase.Query(SQL_FUCKYOU_retired2, sRequest, fuck); + } +} + +public void SQL_FUCKYOU_retired2(Database db, DBResultSet results, const char[] error, DataPack fuck) +{ + if (results.RowCount && results.FetchRow()) + { + Native_AsyncHasSteamIDReservedSlot_OnTransferResponse("Game-Donator", fuck); + } + else + { Native_AsyncHasSteamIDReservedSlot_OnTransferResponse("NOGROUP", fuck); } } @@ -407,4 +491,4 @@ stock void PrintToMe(char[] sText, any:...) } } } -} \ No newline at end of file +}