Viewing past reports.
#1

Howdy, well let me get straight into it, I am trying to create a viewing your past reports command I've figured it out then I've thought of someone what I am doing is.
pawn Код:
CMD:pending(playerid,params[])
{
    if(!Logged[playerid]) return 0;
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new string[320];
        foreach(new i : Player)
        {
            if(PlayerInfo[i][Pending] == 1)
            {
                format(string,sizeof(string),"Pending Report - %s(%i)",sendername(i),i);
            }
        }
        ShowPlayerDialog(playerid,DIALOG_PENDING,DIALOG_STYLE_MSGBOX,"Pending Assistance/Reports",string,"Close","");
    }
    return 1;
}
In this code it will only format one player, means only one report. Do I need to create an array that has around 10 player ids(average max reports) or is there any other way?

Hope you understood, thanks.
Reply
#2

the reports made by the players should be saved somewhere temporarily. An Array should be a good place to save those reports untill someone uses /pending. If the command has been called in, the script can get all the "reports" from that variable/array and show that to you.

Have you tried to work like that?
Reply
#3

pawn Код:
CMD:pending(playerid,params[])
{
    if(!Logged[playerid]) return 0;
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new string[256]; //decreased the size for now
        foreach(new i : Player)
        {
            if(PlayerInfo[i][Pending] == 1)
            {
                format(string,sizeof(string),"%sPending Report - %s(%i)\n",string, sendername(i),i);
            }
        }
        ShowPlayerDialog(playerid,DIALOG_PENDING,DIALOG_STYLE_MSGBOX,"Pending Assistance/Reports",string,"Close","");
    }
    return 1;
}
You weren't "re-formatting" the string, you basically just 'overwrote' it, thus it didn't show all the reported players.
Reply
#4

Quote:
Originally Posted by Kyance
Посмотреть сообщение
pawn Код:
CMD:pending(playerid,params[])
{
    if(!Logged[playerid]) return 0;
    if(PlayerInfo[playerid][pAdmin] >= 1)
    {
        new string[256]; //decreased the size for now
        foreach(new i : Player)
        {
            if(PlayerInfo[i][Pending] == 1)
            {
                format(string,sizeof(string),"%sPending Report - %s(%i)\n",string, sendername(i),i);
            }
        }
        ShowPlayerDialog(playerid,DIALOG_PENDING,DIALOG_STYLE_MSGBOX,"Pending Assistance/Reports",string,"Close","");
    }
    return 1;
}
You weren't "re-formatting" the string, you basically just 'overwrote' it, thus it didn't show all the reported players.
Thanks!
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)