PDA

View Full Version : Tablist Headers


dionisak0s
04/01/2016, 10:27 AM
Below is my code that I use to display all of the Helpers are online. As you can see, I am using a Header, however, if there are more than 1 helper, the headers is getting fucked up. Instead of the header being just on top, it shows up one more time as part of the list.

foreach(new i: Player)
{
if(PlayerInfo[i][pHelper] >= 1 && PlayerInfo[i][pAdmin] < 2)
{
new tdate[11], thour[9], i_timestamp[3];
getdate(i_timestamp[0], i_timestamp[1], i_timestamp[2]);

format(tdate, sizeof(tdate), "%d-%02d-%02d", i_timestamp[0], i_timestamp[1], i_timestamp[2]);
format(thour, sizeof(thour), "%02d:00:00", hour);

if(PlayerInfo[i][pHelper] == 1)
{
format(szDialog, sizeof(szDialog), "%s{FFFFFF}Helper\t%s\t%d\t%d\n", szDialog, GetPlayerNameEx(i), ReportHourCount[i], ReportCount[i]);
}
if(PlayerInfo[i][pHelper] == 2)
{
format(szDialog, sizeof(szDialog), "%s{FFFFFF}Senior Helper\t%s\t%d\t%d\n", szDialog, GetPlayerNameEx(i), ReportHourCount[i], ReportCount[i]);
}
if(PlayerInfo[i][pHelper] == 3)
{
format(szDialog, sizeof(szDialog), "%s{FFFFFF}Head Helper\t%s\t%d\t%d\n", szDialog, GetPlayerNameEx(i), ReportHourCount[i], ReportCount[i]);
}
format(szHeader, sizeof(szHeader), "Rank\tName\tHourly Requests\tRequests Today\n");
strins(szDialog, szHeader, 0);
ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_TABLIST_HEADERS, "Helpers Online", szDialog, "Close", "");
}
}

Vince
04/01/2016, 10:37 AM
The two lines that stand out are:
foreach(new i: Player)
and
ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_TABLIST_HEADERS, "Helpers Online", szDialog, "Close", "");
Or otherwise written as: for each player online, show the dialog again to playerid. The ShowPlayerDialog line and the headers should be outside of the loop.

dionisak0s
04/01/2016, 11:15 AM
The two lines that stand out are:
foreach(new i: Player)
and
ShowPlayerDialog(playerid, DIALOG_NOTHING, DIALOG_STYLE_TABLIST_HEADERS, "Helpers Online", szDialog, "Close", "");
Or otherwise written as: for each player online, show the dialog again to playerid. The ShowPlayerDialog line and the headers should be outside of the loop.

Thanks for your help, it worked.