Add SteamWorks_HasLicenseForApp
This commit is contained in:
@@ -150,6 +150,27 @@ static cell_t sm_ForceHeartbeat(IPluginContext *pContext, const cell_t *params)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static cell_t sm_UserHasLicenseForApp(IPluginContext *pContext, const cell_t *params)
|
||||||
|
{
|
||||||
|
ISteamGameServer *pServer = GetGSPointer();
|
||||||
|
|
||||||
|
if (pServer == NULL)
|
||||||
|
{
|
||||||
|
return k_EUserHasLicenseResultNoAuth;
|
||||||
|
}
|
||||||
|
|
||||||
|
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(pPlayer->GetSteamAccountID(false), static_cast<EUniverse>(params[3]), static_cast<EAccountType>(params[4]));
|
||||||
|
|
||||||
|
return pServer->UserHasLicenseForApp(checkid, params[2]);
|
||||||
|
}
|
||||||
|
|
||||||
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},
|
||||||
@@ -160,6 +181,7 @@ static sp_nativeinfo_t gsnatives[] = {
|
|||||||
{"SteamWorks_SetRule", sm_SetRule},
|
{"SteamWorks_SetRule", sm_SetRule},
|
||||||
{"SteamWorks_ClearRules", sm_ClearRules},
|
{"SteamWorks_ClearRules", sm_ClearRules},
|
||||||
{"SteamWorks_ForceHeartbeat", sm_ForceHeartbeat},
|
{"SteamWorks_ForceHeartbeat", sm_ForceHeartbeat},
|
||||||
|
{"SteamWorks_HasLicenseForApp", sm_UserHasLicenseForApp},
|
||||||
{NULL, NULL}
|
{NULL, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,67 @@
|
|||||||
|
/*
|
||||||
|
This file is part of SourcePawn SteamWorks.
|
||||||
|
|
||||||
|
SourcePawn SteamWorks is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, either version 3 of the License, or
|
||||||
|
(at your option) any later version.
|
||||||
|
|
||||||
|
SourcePawn SteamWorks is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with SourcePawn SteamWorks. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
Author: Kyle Sanderson (KyleS).
|
||||||
|
*/
|
||||||
|
|
||||||
|
#pragma semicolon 1
|
||||||
|
#include <sourcemod>
|
||||||
|
#include <SteamWorks>
|
||||||
|
|
||||||
|
public Plugin:myinfo = {
|
||||||
|
name = "SteamWorks Additive Glider", /* SWAG */
|
||||||
|
author = "Kyle Sanderson",
|
||||||
|
description = "Translates SteamTools calls into SteamWorks calls.",
|
||||||
|
version = "1.0",
|
||||||
|
url = "http://AlliedMods.net"
|
||||||
|
};
|
||||||
|
|
||||||
|
public APLRes:AskPluginLoad2(Handle:myself, bool:late, String:error[], err_max)
|
||||||
|
{
|
||||||
|
CreateNative("Steam_IsVACEnabled", native_IsVACEnabled);
|
||||||
|
CreateNative("Steam_GetPublicIP", native_GetPublicIP);
|
||||||
|
CreateNative("Steam_SetGameDescription", native_SetGameDescription);
|
||||||
|
CreateNative("Steam_IsConnected", native_IsConnected);
|
||||||
|
CreateNative("Steam_SetRule", native_SetRule);
|
||||||
|
CreateNative("Steam_ClearRules", native_ClearRules);
|
||||||
|
CreateNative("Steam_ForceHeartbeat", native_ForceHeartbeat);
|
||||||
|
return APLRes_Success;
|
||||||
|
}
|
||||||
|
|
||||||
|
public native_IsVACEnabled(Handle:plugin, numParams)
|
||||||
|
{
|
||||||
|
return SteamWorks_IsVACEnabled();
|
||||||
|
}
|
||||||
|
|
||||||
|
public native_GetPublicIP(Handle:plugin, numParams)
|
||||||
|
{
|
||||||
|
new addr[4];
|
||||||
|
SteamWorks_GetPublicIP(addr);
|
||||||
|
SetNativeArray(1, addr, sizeof(addr));
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public native_SetGameDescription(Handle:plugin, numParams)
|
||||||
|
{
|
||||||
|
decl String:sDesc[PLATFORM_MAX_PATH];
|
||||||
|
GetNativeString(1, sDesc, sizeof(sDesc));
|
||||||
|
return SteamWorks_SetGameDescription(sDesc);
|
||||||
|
}
|
||||||
|
|
||||||
|
public native_IsConnected(Handle:plugin, numParams)
|
||||||
|
{
|
||||||
|
return SteamWorks_IsConnected();
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user