I would say using StringMap would be the best for you as previously mentioned by "ddhoward ", I cant find his snippet now, but here how it looks like, using it to store points and reset at the start of next chapter
You can reset clients stats every round, or every map according to your need
PHP Code:
#include <sourcemod>
#include <sdkhooks>
#include <sdktools>
#pragma semicolon 1
#pragma newdecls required
int g_iPoints [MAXPLAYERS+1];
StringMap g_smCampaign;
public void OnPluginStart()
{
RegConsoleCmd("sm_mypoints", Command_MyPoints, "Test To Show My Points");
RegConsoleCmd("sm_addpoints", Command_AddPoints, "Test To Add 5 Points");
g_smCampaign = new StringMap();
}
public void OnMapStart()
{
// Clear all clients points at start of every map
g_smCampaign.Clear();
}
Action Command_MyPoints(int client, int args)
{
//Display points command
PrintToChat(client, "Your Points: %d", g_iPoints[client]);
return Plugin_Handled;
}
Action Command_AddPoints(int client, int args)
{
//Add points command
g_iPoints[client] += 5;
return Plugin_Handled;
}
public void OnClientAuthorized(int client, const char[] auth)
{
if (IsFakeClient(client))return;
int StoredPoints;
//If clients have been here before, give them their stored points
if(g_smCampaign.GetValue(auth, StoredPoints)) g_iPoints[client] = StoredPoints;
// Else reset their points to what you need like 0 etc
else g_iPoints[client] = 0;
}
public void OnClientDisconnect(int client)
{
if (IsFakeClient(client)) return;
//Save clients points when disconnecting
char auth[32];
GetClientAuthId(client, AuthId_Steam2, auth, sizeof(auth));
g_smCampaign.SetValue(auth, g_iPoints[client], true);
}
__________________