PlaytimeStats: ignore nosteamers
This commit is contained in:
parent
89191ab5c5
commit
260a6ec6ae
@ -1,10 +1,12 @@
|
||||
#pragma semicolon 1
|
||||
|
||||
#include <sourcemod>
|
||||
#include <PlayerManager>
|
||||
|
||||
Database g_hDatabase;
|
||||
|
||||
int g_iConnectionTime[MAXPLAYERS + 1];
|
||||
bool g_bPlayerValid[MAXPLAYERS + 1];
|
||||
|
||||
public Plugin myinfo =
|
||||
{
|
||||
@ -43,17 +45,22 @@ public Action Command_TopTime(int client, int args)
|
||||
return Plugin_Handled;
|
||||
}
|
||||
|
||||
public void OnClientConnected(int client)
|
||||
public void OnClientAuthorized(int client)
|
||||
{
|
||||
if(IsValidClient(client))
|
||||
{
|
||||
g_bPlayerValid[client] = true;
|
||||
g_iConnectionTime[client] = GetTime();
|
||||
}
|
||||
}
|
||||
|
||||
public void OnClientDisconnect(int client)
|
||||
{
|
||||
if(g_iConnectionTime[client] == 0 || !IsValidClient(client))
|
||||
if(g_iConnectionTime[client] == 0 || !g_bPlayerValid[client])
|
||||
return;
|
||||
|
||||
g_bPlayerValid[client] = false;
|
||||
|
||||
int iPlayTime = GetTime() - g_iConnectionTime[client];
|
||||
|
||||
int iAuthID = GetSteamAccountID(client);
|
||||
@ -207,5 +214,5 @@ public int Handler_Menu(Menu menu, MenuAction action, int param1, int param2)
|
||||
|
||||
stock bool IsValidClient(int client)
|
||||
{
|
||||
return (client >= 1 && client <= MaxClients && !IsFakeClient(client));
|
||||
return (client >= 1 && client <= MaxClients && !IsFakeClient(client) && PM_IsPlayerSteam(client));
|
||||
}
|
Loading…
Reference in New Issue
Block a user