NoSteamPlayerCount: initial release

This commit is contained in:
neon 2018-08-23 16:02:35 +02:00
parent d256b9f9de
commit cd5aa933b5
2 changed files with 150 additions and 8 deletions

View File

@ -0,0 +1,83 @@
#include <sourcemod>
#include <SteamWorks>
#include <connect>
#pragma semicolon 1
#pragma newdecls required
bool g_bConnected[MAXPLAYERS + 1] = {false,...};
public Plugin myinfo =
{
name = "NoSteamPlayerCount",
author = "Neon",
description = "",
version = "1.0",
url = "https://steamcommunity.com/id/n3ontm"
};
//----------------------------------------------------------------------------------------------------
// Purpose:
//----------------------------------------------------------------------------------------------------
public void OnGameFrame()
{
//SteamWorks_SetMapName("ze_FFVII_Mako_Reactor_v5_3");
SteamWorks_SetMaxPlayers(65);
}
public void OnPluginStart()
{
RegAdminCmd("sm_addfake", Command_addfake, ADMFLAG_ROOT, "");
RegAdminCmd("sm_removefake", Command_removefake, ADMFLAG_ROOT, "");
RegAdminCmd("sm_countfakes", Command_countfakes, ADMFLAG_BAN, "");
}
public Action Command_addfake(int client, int argc)
{
SteamWorks_CreateFake("Kaitou Sinbad");
return Plugin_Handled;
}
public Action Command_removefake(int client, int argc)
{
SteamWorks_KickFake();
return Plugin_Handled;
}
public Action Command_countfakes(int client, int argc)
{
int iFakes = SteamWorks_CountFakes();
ReplyToCommand(client, "There are currently %d Fake Clients active.", iFakes);
return Plugin_Handled;
}
public void OnClientPostAdminCheck(int client)
{
char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
char sName[128];
GetClientName(client, sName, sizeof(sName));
if(!SteamClientAuthenticated(sSteamID))
{
int iFakeID = SteamWorks_CreateFake(sName);
g_bConnected[client] = true;
LogMessage("\"%L\" connected as NoSteam. Fake Client with ID: \"%d\" got created.", client, iFakeID);
}
}
public void OnClientDisconnect(int client)
{
if (!g_bConnected[client])
return;
char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
if(!SteamClientAuthenticated(sSteamID))
{
SteamWorks_KickFake();
g_bConnected[client] = false;
LogMessage("\"%L\" left as NoSteam. Fake Client got removed.", client);
}
}

View File

@ -15,7 +15,7 @@ enum EUserHasLicenseForAppResult
enum EResult
{
k_EResultOK = 1, // success
k_EResultFail = 2, // generic failure
k_EResultFail = 2, // generic failure
k_EResultNoConnection = 3, // no/failed network connection
// k_EResultNoConnectionRetry = 4, // OBSOLETE - removed
k_EResultInvalidPassword = 5, // password/ticket is invalid
@ -80,8 +80,8 @@ enum EResult
k_EResultCannotUseOldPassword = 64, // The requested new password is not legal
k_EResultInvalidLoginAuthCode = 65, // account login denied due to auth code invalid
k_EResultAccountLogonDeniedNoMail = 66, // account login denied due to 2nd factor auth failure - and no mail has been sent
k_EResultHardwareNotCapableOfIPT = 67, //
k_EResultIPTInitError = 68, //
k_EResultHardwareNotCapableOfIPT = 67, //
k_EResultIPTInitError = 68, //
k_EResultParentalControlRestricted = 69, // operation failed due to parental control restrictions for current user
k_EResultFacebookQueryError = 70, // Facebook query returned an error
k_EResultExpiredLoginAuthCode = 71, // account login denied due to auth code expired
@ -91,7 +91,33 @@ enum EResult
k_EResultNoMatchingURL = 75,
k_EResultBadResponse = 76, // parse failure, missing field, etc.
k_EResultRequirePasswordReEntry = 77, // The user cannot complete the action until they re-enter their password
k_EResultValueOutOfRange = 78 // the value entered is outside the acceptable range
k_EResultValueOutOfRange = 78, // the value entered is outside the acceptable range
k_EResultUnexpectedError = 79, // something happened that we didn't expect to ever happen
k_EResultDisabled = 80, // The requested service has been configured to be unavailable
k_EResultInvalidCEGSubmission = 81, // The set of files submitted to the CEG server are not valid !
k_EResultRestrictedDevice = 82, // The device being used is not allowed to perform this action
k_EResultRegionLocked = 83, // The action could not be complete because it is region restricted
k_EResultRateLimitExceeded = 84, // Temporary rate limit exceeded, try again later, different from k_EResultLimitExceeded which may be permanent
k_EResultAccountLoginDeniedNeedTwoFactor = 85, // Need two-factor code to login
k_EResultItemDeleted = 86, // The thing we're trying to access has been deleted
k_EResultAccountLoginDeniedThrottle = 87, // login attempt failed, try to throttle response to possible attacker
k_EResultTwoFactorCodeMismatch = 88, // two factor code mismatch
k_EResultTwoFactorActivationCodeMismatch = 89, // activation code for two-factor didn't match
k_EResultAccountAssociatedToMultiplePartners = 90, // account has been associated with multiple partners
k_EResultNotModified = 91, // data not modified
k_EResultNoMobileDevice = 92, // the account does not have a mobile device associated with it
k_EResultTimeNotSynced = 93, // the time presented is out of range or tolerance
k_EResultSmsCodeFailed = 94, // SMS code failure (no match, none pending, etc.)
k_EResultAccountLimitExceeded = 95, // Too many accounts access this resource
k_EResultAccountActivityLimitExceeded = 96, // Too many changes to this account
k_EResultPhoneActivityLimitExceeded = 97, // Too many changes to this phone
k_EResultRefundToWallet = 98, // Cannot refund to payment method, must use wallet
k_EResultEmailSendFailure = 99, // Cannot send an email
k_EResultNotSettled = 100, // Can't perform operation till payment has settled
k_EResultNeedCaptcha = 101, // Needs to provide a valid captcha
k_EResultGSLTDenied = 102, // a game server login token owned by this token's owner has been banned
k_EResultGSOwnerDenied = 103, // game server owner is denied for other reason (account lock, community ban, vac ban, missing phone)
k_EResultInvalidItemType = 104 // the type of thing we were requested to act on is invalid
};
/* This enum is used in client API methods, do not re-number existing values. */
@ -104,8 +130,9 @@ enum EHTTPMethod
k_EHTTPMethodPUT,
k_EHTTPMethodDELETE,
k_EHTTPMethodOPTIONS,
k_EHTTPMethodPATCH,
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for
// The remaining HTTP methods are not yet supported, per rfc2616 section 5.1.1 only GET and HEAD are required for
// a compliant general purpose server. We'll likely add more as we find uses for them.
// k_EHTTPMethodTRACE,
@ -175,11 +202,23 @@ enum EHTTPStatusCode
k_EHTTPStatusCode5xxUnknown = 599,
};
/* list of possible return values from the ISteamGameCoordinator API */
enum EGCResults
{
k_EGCResultOK = 0,
k_EGCResultNoMessage = 1, // There is no message in the queue
k_EGCResultBufferTooSmall = 2, // The buffer is too small for the requested message
k_EGCResultNotLoggedOn = 3, // The client is not logged onto Steam
k_EGCResultInvalidMessage = 4, // Something was wrong with the message being sent with SendMessage
};
native bool:SteamWorks_IsVACEnabled();
native bool:SteamWorks_GetPublicIP(ipaddr[4]);
native SteamWorks_GetPublicIPCell();
native bool:SteamWorks_IsLoaded();
native bool:SteamWorks_SetGameDescription(String:sDesc[]);
native bool:SteamWorks_SetGameData(const String:sData[]);
native bool:SteamWorks_SetGameDescription(const String:sDesc[]);
native bool:SteamWorks_SetMapName(const String:sMapName[]);
native bool:SteamWorks_IsConnected();
native bool:SteamWorks_SetRule(const String:sKey[], const String:sValue[]);
native bool:SteamWorks_ClearRules();
@ -188,6 +227,7 @@ native bool:SteamWorks_GetUserGroupStatus(client, groupid);
native bool:SteamWorks_GetUserGroupStatusAuthID(authid, groupid);
native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForApp(client, app);
native EUserHasLicenseForAppResult:SteamWorks_HasLicenseForAppId(authid, app);
native SteamWorks_GetClientSteamID(client, String:sSteamID[], length);
native bool:SteamWorks_RequestStatsAuthID(authid, appid);
@ -202,6 +242,14 @@ native bool:SteamWorks_SetHTTPRequestContextValue(Handle:hHandle, any:data1, any
native bool:SteamWorks_SetHTTPRequestNetworkActivityTimeout(Handle:hHandle, timeout);
native bool:SteamWorks_SetHTTPRequestHeaderValue(Handle:hHandle, const String:sName[], const String:sValue[]);
native bool:SteamWorks_SetHTTPRequestGetOrPostParameter(Handle:hHandle, const String:sName[], const String:sValue[]);
native bool:SteamWorks_SetHTTPRequestUserAgentInfo(Handle:hHandle, const String:sUserAgentInfo[]);
native bool:SteamWorks_SetHTTPRequestRequiresVerifiedCertificate(Handle:hHandle, bool:bRequireVerifiedCertificate);
native bool:SteamWorks_SetHTTPRequestAbsoluteTimeoutMS(Handle:hHandle, unMilliseconds);
native int:SteamWorks_CreateFake(const String:sPlayerName[]);
native bool:SteamWorks_KickFake();
native int:SteamWorks_CountFakes();
native bool:SteamWorks_SetMaxPlayers(int Players);
funcenum SteamWorksHTTPRequestCompleted
{
@ -235,6 +283,7 @@ native bool:SteamWorks_GetHTTPResponseBodySize(Handle:hRequest, &size);
native bool:SteamWorks_GetHTTPResponseBodyData(Handle:hRequest, String:sBody[], length);
native bool:SteamWorks_GetHTTPStreamingResponseBodyData(Handle:hRequest, cOffset, String:sBody[], length);
native bool:SteamWorks_GetHTTPDownloadProgressPct(Handle:hRequest, &Float:percent);
native bool:SteamWorks_GetHTTPRequestWasTimedOut(Handle:hRequest, &bool:bWasTimedOut);
native bool:SteamWorks_SetHTTPRequestRawPostBody(Handle:hRequest, const String:sContentType[], const String:sBody[], bodylen);
funcenum SteamWorksHTTPBodyCallback
@ -258,7 +307,13 @@ forward SteamWorks_TokenRequested(String:sToken[], maxlen);
forward SteamWorks_OnClientGroupStatus(authid, groupid, bool:isMember, bool:isOfficer);
public Extension:__ext_SteamWorks =
forward EGCResults:SteamWorks_GCSendMessage(unMsgType, const String:pubData[], cubData);
forward SteamWorks_GCMsgAvailable(cubData);
forward EGCResults:SteamWorks_GCRetrieveMessage(punMsgType, const String:pubDest[], cubDest, pcubMsgSize);
native EGCResults:SteamWorks_SendMessageToGC(unMsgType, const String:pubData[], cubData);
public Extension:__ext_SteamWorks =
{
name = "SteamWorks",
file = "SteamWorks.ext",
@ -281,6 +336,7 @@ public __ext_SteamWorks_SetNTVOptional()
MarkNativeAsOptional("SteamWorks_GetPublicIP");
MarkNativeAsOptional("SteamWorks_GetPublicIPCell");
MarkNativeAsOptional("SteamWorks_IsLoaded");
MarkNativeAsOptional("SteamWorks_SetGameData");
MarkNativeAsOptional("SteamWorks_SetGameDescription");
MarkNativeAsOptional("SteamWorks_IsConnected");
MarkNativeAsOptional("SteamWorks_SetRule");
@ -290,6 +346,7 @@ public __ext_SteamWorks_SetNTVOptional()
MarkNativeAsOptional("SteamWorks_GetUserGroupStatusAuthID");
MarkNativeAsOptional("SteamWorks_HasLicenseForApp");
MarkNativeAsOptional("SteamWorks_HasLicenseForAppId");
MarkNativeAsOptional("SteamWorks_GetClientSteamID");
MarkNativeAsOptional("SteamWorks_RequestStatsAuthID");
@ -299,6 +356,8 @@ public __ext_SteamWorks_SetNTVOptional()
MarkNativeAsOptional("SteamWorks_GetStatFloat");
MarkNativeAsOptional("SteamWorks_GetStatAuthIDFloat");
MarkNativeAsOptional("SteamWorks_SendMessageToGC");
MarkNativeAsOptional("SteamWorks_CreateHTTPRequest");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestContextValue");
MarkNativeAsOptional("SteamWorks_SetHTTPRequestNetworkActivityTimeout");
@ -321,4 +380,4 @@ public __ext_SteamWorks_SetNTVOptional()
MarkNativeAsOptional("SteamWorks_GetHTTPResponseBodyCallback");
MarkNativeAsOptional("SteamWorks_WriteHTTPResponseBodyToFile");
}
#endif
#endif