Skip to content

Commit

Permalink
sm_veterans_excludeprimes and sm_veterans_kickf2p added for prime…
Browse files Browse the repository at this point in the history
… status check for TF2 and CSGO
  • Loading branch information
falahati committed Jun 10, 2020
1 parent 7585124 commit 84b43f7
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 2 deletions.
36 changes: 34 additions & 2 deletions scripting/veterans.sp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#pragma dynamic 645221
#define AUTOLOAD_EXTENSIONS
#define REQUIRE_EXTENSIONS
#define PLUGIN_VERSION "1.2"
#define PLUGIN_VERSION "1.3"

#include <SteamWorks>

Expand All @@ -19,6 +19,8 @@ new Handle:cvar_kickWhenFailure;
new Handle:cvar_kickWhenPrivate;
new Handle:cvar_excludeReservedSlots;
new Handle:cvar_excludePrivileged;
new Handle:cvar_excludePrimes;
new Handle:cvar_kickF2P;
new Handle:cvar_banTime;
new Handle:cvar_gameId;

Expand Down Expand Up @@ -111,6 +113,18 @@ public OnPluginStart()
"Amount of time in seconds that we should not send a delicate request for the same query.",
FCVAR_NONE, true, 0.0, true, 31536000.0
);
cvar_excludePrimes = CreateConVar(
"sm_veterans_excludeprimes",
"0",
"Should we exclude players that have a prime status from punishment?",
FCVAR_NONE, true, 0.0, true, 1.0
);
cvar_kickF2P = CreateConVar(
"sm_veterans_kickf2p",
"0",
"Should we punish players that are using free 2 play version of the game?",
FCVAR_NONE, true, 0.0, true, 1.0
);

RegAdminCmd("sm_veterans_exclude", ExcludeUser, ADMFLAG_GENERIC, "Exludes a user from veterans plugin", "", 0);
RegAdminCmd("sm_veterans_include", IncludeUser, ADMFLAG_GENERIC, "Includes an already excluded user from veterans plugin", "", 0);
Expand Down Expand Up @@ -160,6 +174,24 @@ public OnClientAuthorized(client, const String:steamId[])
return;
}


EngineVersion engine = GetEngineVersion();
if (engine == Engine_CSGO || engine == Engine_TF2) {
new isPrime = engine == Engine_CSGO ?
SteamWorks_HasLicenseForApp(client, 624820) == k_EUserHasLicenseResultHasLicense :
SteamWorks_HasLicenseForApp(client, 459) == k_EUserHasLicenseResultHasLicense;

if (GetConVarBool(cvar_excludePrimes) && isPrime) {
return;
}

if (GetConVarBool(cvar_kickF2P) && !isPrime) {
decl String:formated[128];
Format(formated, sizeof(formated), "%T", "PRIMENEEDED", client);
ThrowOut(client, formated);
}
}

new totalTime, last2WeeksTime;
if (GetCache(SteamIdToInt(steamId), totalTime, last2WeeksTime))
{
Expand All @@ -184,7 +216,7 @@ ApplyDecision(client, totalTime, last2WeeksTime)
decl String:formated[256];
Format(
formated,
sizeof formated,
sizeof (formated),
"%T",
"REJECTED",
client,
Expand Down
5 changes: 5 additions & 0 deletions translations/veterans.phrases.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,4 +27,9 @@
"#format" "{1:s}"
"en" "SteamId {1} removed from the exclude list"
}

"PRIMENEEDED"
{
"en" "You need to have a prime status to be able to play on this server"
}
}

0 comments on commit 84b43f7

Please sign in to comment.