Thanks for this great basic stats plugin FrostbyteX, I've been running
it on my CS:S deathmatch server.
I'd like to suggest 3 more features...
1. Pruning interval adjustable via cvar
2. Points decay for inactivity
3. Command to reset individual player stats (purge hacker's stats)
I fixed two bugs:
1. When setting cvar sm_stats_startpoints to 0, new players
cause divide by zero error when using session and statsme commands.
Fix: Check for stats[STAT_KILLS] = 0
Code:
session.sp line 44, statsme.sp line 42
if(stats[STAT_HEADSHOTS] > 0 && stats[STAT_KILLS] != 0) // fix
{
DrawPanelItem(panel, "Headshots");
Format(text, sizeof(text), "%i (%i%%)", stats[STAT_HEADSHOTS], (100*stats[STAT_HEADSHOTS]/stats[STAT_KILLS]));
DrawPanelText(panel, text);
}
2. When players connect then quickly disconnect, GetClientName() throws
a player not found error inside SQL_CreatePlayerCallback()
Fix: Check for connected client
Code:
sodstats.sp
public SQL_CreatePlayerCallback(Handle:owner, Handle:hndl, const String:error[], any:data)
{
new client = data;
if(hndl != INVALID_HANDLE)
{
if(IsClientConnected(client)) // fix
GetClientName(client, g_name[client], MAX_NAME_LENGTH);
g_kills[client] = 0;