There are maybe already plugin like this...
I made this quick one. Don't know how well it work.
Require
[ANY] SteamWorks
http://users.alliedmods.net/~kyles/builds/SteamWorks/
-
Admins who have flag "b" bypass check.
This can be override to another flag(s) using word "sm_haslicenseforapp" or using same word to grant access to admin group without give admin flag itself.
Can be also remove all flags, then it would be public access.
PHP Code:
/*
k_EUserHasLicenseResultHasLicense = 0, // User has a license for specified app
k_EUserHasLicenseResultDoesNotHaveLicense = 1, // User does not have a license for the specified app
k_EUserHasLicenseResultNoAuth = 2, // User has not been authenticated
*/
#include <SteamWorks>
#include <basecomm>
bool HasLicenseForApp[MAXPLAYERS+1];
public void OnPluginStart()
{
for(int i = 1; i <= MaxClients; i++)
if(IsClientInGame(i)) OnClientPostAdminCheck(i);
}
public void OnClientPostAdminCheck(int client)
{
if(IsFakeClient(client))
{
HasLicenseForApp[client] = true;
}
else if(CheckCommandAccess(client, "sm_haslicenseforapp", ADMFLAG_GENERIC))
{
HasLicenseForApp[client] = true;
}
else
{
HasLicenseForApp[client] = SteamWorks_HasLicenseForApp(client, 624820) == k_EUserHasLicenseResultHasLicense;
}
BaseComm_SetClientMute(client, !HasLicenseForApp[client]); // true is false and false is true
}
public Action OnClientSayCommand(int client, const char[] command, const char[] sArgs)
{
if(client == 0 || HasLicenseForApp[client])
return Plugin_Continue;
if(IsClientInGame(client))
{
PrintToChat(client, " \x02[SM] Free 2 Play accounts are muted. To able to communicate on server, buy a game.");
}
return Plugin_Handled;
}
__________________