View Single Post
Balimbanana
Member
Join Date: Jan 2017
Old 06-28-2020 , 23:03   Re: i need a functional steamgroup plugin
Reply With Quote #4

Can you give specific examples?
Are you running the latest SourceMod/MetaMod and SteamWorks extensions?
Are you sure the group ID that was used is correct?
What methods are you using to hook the commands to be filtered by group status?
Have you tried any of the SteamWorks natives in a test plugin, something like this:
Code:
#include <sourcemod>
#include <SteamWorks>
#pragma newdecls required;
#pragma semicolon 1;

static int _GroupIDINT = yourgroupID;
int _CLAuthID[128];
bool HasAccess[128];

public void OnMapStart()
{
	for (int i = 0;i<MaxClients+1;i++)
	{
		HasAccess[i] = false;
		_CLAuthID[i] = 0;
	}
}

public void OnClientAuthorized(int client, const char[] auth)
{
	HasAccess[client] = false;
	char authget[128];
	GetClientAuthId(client,AuthId_Steam3,authget,sizeof(authget));
	char authbreak[4][64];
	int lastpos = ExplodeString(authget,":",authbreak,4,64);
	Format(authget,sizeof(authget),"%s",authbreak[lastpos-1]);
	ReplaceString(authget,sizeof(authget),"]","",false);
	_CLAuthID[client] = StringToInt(authget);
	SteamWorks_GetUserGroupStatus(client, _GroupIDINT);
}

public int SteamWorks_OnClientGroupStatus(int authid, int groupid, bool isMember, bool isOfficer)
{
	int client = -1;
	for (int i = 0;i<MaxClients+1;i++)
	{
		if (authid == _CLAuthID[i])
		{
			client = i;
			break;
		}
	}
	if (isMember)
	{
		if (client != -1)
		{
			PrintToServer("Client %i is a member of group %i OfficerStatus: %i",client,groupid,isOfficer);
			HasAccess[client] = true;
			return 1;
		}
	}
	PrintToServer("Client %i is not a member",authid);
	if (client != -1) HasAccess[client] = false;
	return -1;
}

Last edited by Balimbanana; 06-28-2020 at 23:44.
Balimbanana is offline