SA-MP Forums Archive
Tablist Headers - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Tablist Headers (/showthread.php?tid=597731)



Tablist Headers - dionisak0s - 04.01.2016

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", "");
    }
}



Re: Tablist Headers - Vince - 04.01.2016

The two lines that stand out are:
PHP код:
foreach(new iPlayer
and
PHP код:
ShowPlayerDialog(playeridDIALOG_NOTHINGDIALOG_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.


Re: Tablist Headers - dionisak0s - 04.01.2016

Quote:
Originally Posted by Vince
Посмотреть сообщение
The two lines that stand out are:
PHP код:
foreach(new iPlayer
and
PHP код:
ShowPlayerDialog(playeridDIALOG_NOTHINGDIALOG_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.