...problem start at beginning with characters in menu. "space" is short and doesn't line well.
So need double spaces.
PHP Code:
public void OnPluginStart()
{
RegConsoleCmd("sm_test", test);
}
public Action test(int client, int args)
{
Panel panel = new Panel();
panel.SetTitle("Top Players");
char bufferpoints[20];
char buffer[200];
char names[][] = {"", "<- This exceed by one", "Harry", "Matt", "John", "Lisa", "George", "Alpha", "Beta", "Omega", "Apple"};
int points[] = {0, 211111000, 2333300, 22200, 17700, 800, 50, 9, 7, 5, 1};
for(int x = 1; x <= 10; x++)
{
Format(bufferpoints, sizeof(bufferpoints), "%8d", points[x]);
int index = FindCharInString(bufferpoints, ' ', true);
PrintToServer("index %i", index);
// double spaces
for(int a = 0; a <= index; a++)
{
Format(bufferpoints, sizeof(bufferpoints), " %s", bufferpoints);
}
Format(buffer, sizeof(buffer), "%02i. %s - %s", x, bufferpoints, names[x]);
panel.DrawText(buffer);
PrintToServer("%s", buffer);
}
panel.Send(client, panel_handler, 20);
delete panel;
return Plugin_Handled;
}
public int panel_handler(Menu menu, MenuAction action, int param1, int param2) {}