NoSteamPlayerCount: lade load/unload support (untested)

This commit is contained in:
neon 2018-08-23 17:34:48 +02:00
parent cd5aa933b5
commit c85025e69d

View File

@ -30,6 +30,21 @@ public void OnPluginStart()
RegAdminCmd("sm_addfake", Command_addfake, ADMFLAG_ROOT, "");
RegAdminCmd("sm_removefake", Command_removefake, ADMFLAG_ROOT, "");
RegAdminCmd("sm_countfakes", Command_countfakes, ADMFLAG_BAN, "");
for(int client = 1; client <= MaxClients; client++)
{
if(IsValidClient(client))
OnClientAuthorized(client, "xxx");
}
}
public void OnPluginEnd()
{
for(int client = 1; client <= MaxClients; client++)
{
if(IsValidClient(client))
OnClientDisconnect(client);
}
}
public Action Command_addfake(int client, int argc)
@ -51,7 +66,7 @@ public Action Command_countfakes(int client, int argc)
return Plugin_Handled;
}
public void OnClientPostAdminCheck(int client)
public void OnClientAuthorized(int client, const char[] auth)
{
char sSteamID[32];
GetClientAuthId(client, AuthId_Steam2, sSteamID, sizeof(sSteamID));
@ -78,6 +93,23 @@ public void OnClientDisconnect(int client)
{
SteamWorks_KickFake();
g_bConnected[client] = false;
LogMessage("\"%L\" left as NoSteam. Fake Client got removed.", client);
LogMessage("\"%L\" left as NoSteam. Fake Client got removed.", client);
}
}
public bool IsValidClient(int client)
{
if (client <= 0)
return false;
if (client > GetMaxClients())
return false;
if (!IsClientInGame(client))
return false;
if (!IsClientAuthorized(client))
return false;
return true;
}