#include <sourcemod>
#pragma newdecls required
#pragma semicolon 1
#define MAX_STEAM_ID 64
char g_szPath[PLATFORM_MAX_PATH];
char g_szSteamId[MAX_STEAM_ID][32];
public void OnPluginStart()
{
BuildPath(Path_SM, g_szPath, sizeof(g_szPath), "configs/steam_id.txt");
}
public void OnMapStart()
{
if(FileExists(g_szPath))
{
File file = OpenFile(g_szPath, "r");
int i = 0;
while(!IsEndOfFile(file) && ReadFileLine(file, g_szSteamId[i], sizeof(g_szSteamId[])))
++i;
}
}
public void OnClientAuthorized(int client, const char[] auth)
{
if(IsValidClient(client))
{
bool playerFound;
for(int i = 0; i < MAX_STEAM_ID; ++i)
{
if(!strcmp(auth, g_szSteamId[i]))
{
playerFound = true;
break;
}
}
if(!playerFound)
KickClient(client);
}
}
stock bool IsValidClient(int iClient) { return (iClient > 0 && iClient <= MaxClients && IsClientInGame(iClient) && !IsFakeClient(iClient)); }