Add UserGroupStatus (untested).
This commit is contained in:
@@ -200,6 +200,39 @@ static cell_t sm_GetClientSteamID(IPluginContext *pContext, const cell_t *params
|
|||||||
return numBytes;
|
return numBytes;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetUserGroupStatus(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
ISteamGameServer *pServer = GetGSPointer();
|
||||||
|
|
||||||
|
if (pServer == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
int client = gamehelpers->ReferenceToIndex(params[1]);
|
||||||
|
IGamePlayer *pPlayer = playerhelpers->GetGamePlayer(client); /* Man, including GameHelpers and PlayerHelpers for this native :(. */
|
||||||
|
if (pPlayer == NULL || pPlayer->IsConnected() == false)
|
||||||
|
{
|
||||||
|
return pContext->ThrowNativeError("Client index %d is invalid", params[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
CSteamID checkid = CreateCommonCSteamID(pPlayer, params);
|
||||||
|
return pServer->RequestUserGroupStatus(checkid, CSteamID(params[2], k_EUniversePublic, k_EAccountTypeClan));
|
||||||
|
}
|
||||||
|
|
||||||
|
static cell_t sm_GetUserGroupStatusAuthID(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
ISteamGameServer *pServer = GetGSPointer();
|
||||||
|
|
||||||
|
if (pServer == NULL)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
CSteamID checkid = CreateCommonCSteamID(params[1], params, 3, 4);
|
||||||
|
return pServer->RequestUserGroupStatus(checkid, CSteamID(params[2], k_EUniversePublic, k_EAccountTypeClan));
|
||||||
|
}
|
||||||
|
|
||||||
static sp_nativeinfo_t gsnatives[] = {
|
static sp_nativeinfo_t gsnatives[] = {
|
||||||
{"SteamWorks_IsVACEnabled", sm_IsVACEnabled},
|
{"SteamWorks_IsVACEnabled", sm_IsVACEnabled},
|
||||||
{"SteamWorks_GetPublicIP", sm_GetPublicIP},
|
{"SteamWorks_GetPublicIP", sm_GetPublicIP},
|
||||||
@@ -212,6 +245,8 @@ static sp_nativeinfo_t gsnatives[] = {
|
|||||||
{"SteamWorks_ForceHeartbeat", sm_ForceHeartbeat},
|
{"SteamWorks_ForceHeartbeat", sm_ForceHeartbeat},
|
||||||
{"SteamWorks_HasLicenseForApp", sm_UserHasLicenseForApp},
|
{"SteamWorks_HasLicenseForApp", sm_UserHasLicenseForApp},
|
||||||
{"SteamWorks_GetClientSteamID", sm_GetClientSteamID},
|
{"SteamWorks_GetClientSteamID", sm_GetClientSteamID},
|
||||||
|
{"SteamWorks_GetUserGroupStatus", sm_GetUserGroupStatus},
|
||||||
|
{"SteamWorks_GetUserGroupStatusAuthID", sm_GetUserGroupStatusAuthID},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -23,13 +23,15 @@ SteamWorksForwards::SteamWorksForwards() :
|
|||||||
m_CallbackValidateTicket(this, &SteamWorksForwards::OnValidateTicket),
|
m_CallbackValidateTicket(this, &SteamWorksForwards::OnValidateTicket),
|
||||||
m_CallbackSteamConnected(this, &SteamWorksForwards::OnSteamServersConnected),
|
m_CallbackSteamConnected(this, &SteamWorksForwards::OnSteamServersConnected),
|
||||||
m_CallbackSteamConnectFailure(this, &SteamWorksForwards::OnSteamServersConnectFailure),
|
m_CallbackSteamConnectFailure(this, &SteamWorksForwards::OnSteamServersConnectFailure),
|
||||||
m_CallbackSteamDisconnected(this, &SteamWorksForwards::OnSteamServersDisconnected)
|
m_CallbackSteamDisconnected(this, &SteamWorksForwards::OnSteamServersDisconnected),
|
||||||
|
m_CallbackGroupStatus(this, &SteamWorksForwards::OnGroupStatusResult)
|
||||||
{
|
{
|
||||||
this->pFOVC_Old = forwards->CreateForward("SW_OnValidateClient", ET_Ignore, 2, NULL, Param_Cell, Param_Cell);
|
this->pFOVC_Old = forwards->CreateForward("SW_OnValidateClient", ET_Ignore, 2, NULL, Param_Cell, Param_Cell);
|
||||||
this->pFOVC = forwards->CreateForward("SteamWorks_OnValidateClient", ET_Ignore, 2, NULL, Param_Cell, Param_Cell);
|
this->pFOVC = forwards->CreateForward("SteamWorks_OnValidateClient", ET_Ignore, 2, NULL, Param_Cell, Param_Cell);
|
||||||
this->pFOSSC = forwards->CreateForward("SteamWorks_SteamServersConnected", ET_Ignore, 0, NULL);
|
this->pFOSSC = forwards->CreateForward("SteamWorks_SteamServersConnected", ET_Ignore, 0, NULL);
|
||||||
this->pFOSSCF = forwards->CreateForward("SteamWorks_SteamServersConnectFailure", ET_Ignore, 1, NULL, Param_Cell);
|
this->pFOSSCF = forwards->CreateForward("SteamWorks_SteamServersConnectFailure", ET_Ignore, 1, NULL, Param_Cell);
|
||||||
this->pFOSSD = forwards->CreateForward("SteamWorks_SteamServersDisconnected", ET_Ignore, 1, NULL, Param_Cell);
|
this->pFOSSD = forwards->CreateForward("SteamWorks_SteamServersDisconnected", ET_Ignore, 1, NULL, Param_Cell);
|
||||||
|
this->pFOCGS = forwards->CreateForward("SteamWorks_OnClientGroupStatus", ET_Ignore, 4, NULL, Param_Cell, Param_Cell, Param_Cell, Param_Cell);
|
||||||
}
|
}
|
||||||
|
|
||||||
SteamWorksForwards::~SteamWorksForwards()
|
SteamWorksForwards::~SteamWorksForwards()
|
||||||
@@ -100,3 +102,16 @@ void SteamWorksForwards::OnSteamServersDisconnected(SteamServersDisconnected_t *
|
|||||||
this->pFOSSD->Execute(NULL);
|
this->pFOSSD->Execute(NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SteamWorksForwards::OnGroupStatusResult(GSClientGroupStatus_t *pResponse)
|
||||||
|
{
|
||||||
|
if (this->pFOCGS->GetFunctionCount() == 0)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this->pFOCGS->PushCell(pResonse->m_SteamIDUser.GetAccountID());
|
||||||
|
this->pFOCGS->PushCell(pResonse->m_SteamIDGroup.GetAccountID());
|
||||||
|
this->pFOCGS->PushCell(pResonse->m_bMember);
|
||||||
|
this->pFOCGS->PushCell(pResonse->m_bOfficer);
|
||||||
|
this->pFOCGS->Execute(NULL);
|
||||||
|
}
|
||||||
@@ -38,6 +38,7 @@ class SteamWorksForwards
|
|||||||
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersConnected, SteamServersConnected_t, m_CallbackSteamConnected);
|
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersConnected, SteamServersConnected_t, m_CallbackSteamConnected);
|
||||||
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersConnectFailure, SteamServerConnectFailure_t, m_CallbackSteamConnectFailure);
|
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersConnectFailure, SteamServerConnectFailure_t, m_CallbackSteamConnectFailure);
|
||||||
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersDisconnected, SteamServersDisconnected_t, m_CallbackSteamDisconnected);
|
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnSteamServersDisconnected, SteamServersDisconnected_t, m_CallbackSteamDisconnected);
|
||||||
|
STEAM_GAMESERVER_CALLBACK(SteamWorksForwards, OnGroupStatusResult, GSClientGroupStatus_t, m_CallbackGroupStatus);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
IForward *pFOVC; /* Forward On Validate Client */
|
IForward *pFOVC; /* Forward On Validate Client */
|
||||||
@@ -45,4 +46,5 @@ class SteamWorksForwards
|
|||||||
IForward *pFOSSC; /* Forward On Steam Servers Connected */
|
IForward *pFOSSC; /* Forward On Steam Servers Connected */
|
||||||
IForward *pFOSSCF; /* Forward On Steam Servers Connect Failure */
|
IForward *pFOSSCF; /* Forward On Steam Servers Connect Failure */
|
||||||
IForward *pFOSSD; /* Forward On Steam Servers Disconnected */
|
IForward *pFOSSD; /* Forward On Steam Servers Disconnected */
|
||||||
|
IForward *pFOCGS; /* Forward On Client Group Status */
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -279,6 +279,8 @@ public __ext_SteamWorks_SetNTVOptional()
|
|||||||
MarkNativeAsOptional("SteamWorks_SetRule");
|
MarkNativeAsOptional("SteamWorks_SetRule");
|
||||||
MarkNativeAsOptional("SteamWorks_ClearRules");
|
MarkNativeAsOptional("SteamWorks_ClearRules");
|
||||||
MarkNativeAsOptional("SteamWorks_ForceHeartbeat");
|
MarkNativeAsOptional("SteamWorks_ForceHeartbeat");
|
||||||
|
MarkNativeAsOptional("SteamWorks_GetUserGroupStatus");
|
||||||
|
MarkNativeAsOptional("SteamWorks_GetUserGroupStatusAuthID");
|
||||||
|
|
||||||
MarkNativeAsOptional("SteamWorks_HasLicenseForApp");
|
MarkNativeAsOptional("SteamWorks_HasLicenseForApp");
|
||||||
MarkNativeAsOptional("SteamWorks_GetClientSteamID");
|
MarkNativeAsOptional("SteamWorks_GetClientSteamID");
|
||||||
|
|||||||
Reference in New Issue
Block a user