I have mental block now, just to clear my point I will list the callback function here
PHP Code:
Action Command_Top(int client, int args)
{
g_KeyValue.Rewind();
if(!g_KeyValue.JumpToKey("Players Information"))
{
delete g_KeyValue;
ThrowError("Corrupted file %s.", g_sData_Path);
}
//int iCount = GetTotalPlayersInTheDataFile();
int iPoints[100], iNumber = 0;
char sName[100][32], sSteamID[100][32], sTemp[64];
Menu menu = new Menu(Handle_ShowTop10);
menu.SetTitle("Top 5 Ranks:");
if(g_KeyValue.GotoFirstSubKey())
{
do
{
g_KeyValue.GetSectionName(sSteamID[iNumber], sizeof(sSteamID));
g_KeyValue.GetString("Player Name", sName[iNumber], sizeof(sName));
iPoints[iNumber] = g_KeyValue.GetNum("Total Points");
iNumber++;
}
while(g_KeyValue.GotoNextKey());
}
SortIntegers(iPoints, 100, Sort_Descending);
for (int i = 0; i < 5; i++)
{
FormatEx(sTemp, sizeof(sTemp), "%s: %d points", sName[i], iPoints[i]);
menu.AddItem(sSteamID[i], sTemp, ITEMDRAW_DEFAULT);
}
menu.ExitBackButton = true;
menu.Display(client, MENU_TIME_FOREVER);
return Plugin_Handled;
}
its totally showing the top 5 players when called, but my issue, if the players count in the data file exceeded the [100], how to make it fit exactly my long data list.
So this part would be dunno something like this
PHP Code:
int iCount = GetTotalPlayersInTheDataFile();
int iPoints[iCount ], iNumber = 0;
char sName[iCount ][32], sSteamID[iCount ][32], sTemp[64];
I also updated the post, cause I was poorly explaining my point, which I think its a little bit better
__________________