Why wont this work?
#1

If someone does /admins it only shows 1 admin even if there are more...

pawn Код:
if(strcmp(cmdtext,"/admins",true) == 0)
    {
        new string[200],string2[50],oadmins = 0;
        for(new i = 0; i < MAX_PLAYERS; i++)
        {
            if(pinfo2[i][pAdminLevel] >= 1)
            {
                format(string,sizeof(string),""lgreen"%s\n",GetPName(i));
                oadmins++;
            }
        }
        format(string2,sizeof(string2),"Online admins: %i",oadmins);
        ShowPlayerDialog(playerid,2351,0,string2,string,"Ok","Close");
        return 1;
    }
Thanks.
Reply
#2

You need to reformat the string in the same format!

pawn Код:
format(string,sizeof(string),"%s"lgreen"%s \n",string, GetPName(i));

My version of yours;

pawn Код:
if ( !strcmp( cmdtext, "/admins" ))
{
    new
        Str[512],
        Str2[30]
        oadmins = 0;
    for ( new i = 0; i < MAX_PLAYERS; i++ )
    {
        if ( pinfo2[ i ][ pAdminLevel ] > 0 )
        {
            format( Str, sizeof ( Str ), "%s"lgreen"%s\n",Str, GetPName( i ) );
            oadmins++;
        }
    }
    format( Str2, sizeof( Str2 ), "Online admins: %i", oadmins );
    ShowPlayerDialog( playerid, 2351, 0, Str2, Str, "Close", "" );
    return 1;
}
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)