removed the other forum integration, just updated the normal one to use 1.11 sourcemod syntax

This commit is contained in:
2024-12-19 12:52:39 +01:00
parent 2abc67625c
commit 3e16e1a3c5
2 changed files with 30 additions and 435 deletions
@@ -9,6 +9,7 @@
#include <SteamWorks>
#include <unloze>
#include <UNLOZE.secret> //#define UNLOZE_APIKEY here
#include <cstrike>
#pragma newdecls required
@@ -37,6 +38,7 @@ public Plugin myinfo =
//----------------------------------------------------------------------------------------------------
public void OnPluginStart()
{
/* Late load */
for(int client = 1; client <= MaxClients; client++)
{
@@ -87,6 +89,7 @@ public Action OnRebuildAdminCachePost(Handle hTimer)
if(G_bResponsePassed[client] && G_bPreAdminChecked[client])
ApplyGroupFlags(client);
}
return Plugin_Handled;
}
//----------------------------------------------------------------------------------------------------
@@ -148,7 +151,7 @@ public int OnClientAuthorized_OnTransferComplete(Handle hRequest, bool bFailure,
if (!client) //Player disconnected.
{
delete hRequest;
return;
return 0;
}
if (bFailure || !bSuccessful || eStatusCode != k_EHTTPStatusCode200OK)
@@ -159,10 +162,11 @@ public int OnClientAuthorized_OnTransferComplete(Handle hRequest, bool bFailure,
NotifyPostAdminCheck(client);
delete hRequest;
return;
return 0;
}
SteamWorks_GetHTTPResponseBodyCallback(hRequest, OnClientAuthorized_OnTransferResponse, iSerial);
return 0;
}
//----------------------------------------------------------------------------------------------------
@@ -171,11 +175,11 @@ public int OnClientAuthorized_OnTransferComplete(Handle hRequest, bool bFailure,
public int OnClientAuthorized_OnTransferResponse(char[] sData, int iSerial)
{
char splitData[2][32];
int client = GetClientFromSerial(iSerial);
if (!client) //Player disconnected.
return;
return 0;
TrimString(sData);
StripQuotes(sData);
@@ -189,14 +193,15 @@ public int OnClientAuthorized_OnTransferResponse(char[] sData, int iSerial)
if(!StrEqual(splitData[0], "NOGROUP"))
{
strcopy(G_sGroup[client], sizeof(G_sGroup[]), splitData[0]);
G_bResponsePassed[client] = true;
if (G_bPreAdminChecked[client])
NotifyPostAdminCheck(client);
}
else
G_bResponseFailed[client] = true; //users with just a forum name did not pass the VIP check! so the response "failed" (but we store their forum name for later!)
return 0;
}
//----------------------------------------------------------------------------------------------------
@@ -240,7 +245,8 @@ stock void ApplyGroupFlags(int client)
SetUserAdmin(client, AdmID, true);
}
if ((GrpID = FindAdmGroup(G_sGroup[client])) != INVALID_GROUP_ID)
if ((GrpID = FindAdmGroup(G_sGroup[client])) != INVALID_GROUP_ID)
{
if (AdminInheritGroup(AdmID, GrpID))
{
@@ -259,6 +265,7 @@ public int Native_GetClientForumName(Handle plugin, int numParams)
int client = GetNativeCell(1);
SetNativeString(2, G_sName[client], len+1);
return 0;
}
@@ -270,8 +277,8 @@ public int Native_AsyncHasSteamIDReservedSlot(Handle plugin, int numParams)
char sSteamID32[32];
GetNativeString(1, sSteamID32, sizeof(sSteamID32));
AsyncHasSteamIDReservedSlotCallbackFunc callback;
callback = GetNativeCell(2);
Function callback; //https://github.com/alliedmodders/sourcepawn/issues/778
callback = GetNativeFunction(2);
any data;
data = GetNativeCell(3);
@@ -296,6 +303,7 @@ public int Native_AsyncHasSteamIDReservedSlot(Handle plugin, int numParams)
{
delete hRequest;
}
return 0;
}
//----------------------------------------------------------------------------------------------------
@@ -309,10 +317,11 @@ public int Native_AsyncHasSteamIDReservedSlot_OnTransferComplete(Handle hRequest
Native_AsyncHasSteamIDReservedSlot_OnTransferResponse(sData, hDataPack);
delete hRequest;
return;
return 0;
}
SteamWorks_GetHTTPResponseBodyCallback(hRequest, Native_AsyncHasSteamIDReservedSlot_OnTransferResponse, hDataPack);
return 0;
}
//----------------------------------------------------------------------------------------------------
@@ -325,8 +334,8 @@ public int Native_AsyncHasSteamIDReservedSlot_OnTransferResponse(char[] sData, D
char sSteamID32[32];
hDataPack.ReadString(sSteamID32, sizeof(sSteamID32));
AsyncHasSteamIDReservedSlotCallbackFunc callback;
callback = view_as<AsyncHasSteamIDReservedSlotCallbackFunc>(hDataPack.ReadFunction());
Function callback;
callback = hDataPack.ReadFunction();
Handle plugin;
plugin = hDataPack.ReadCell();
@@ -354,7 +363,7 @@ public int Native_AsyncHasSteamIDReservedSlot_OnTransferResponse(char[] sData, D
Call_Finish();
delete hDataPack;
return;
return 0;
}
//----------------------------------------------------------------------------------------------------
@@ -384,3 +393,11 @@ stock bool SteamID32toSteamID64(const char[] sSteamID32, char[] sSteamID64, int
return true;
}
stock bool IsValidClient(int client)
{
if (client > 0 && client <= MaxClients && IsClientConnected(client) && IsClientInGame(client))
return true;
return false;
}