SA-MP Forums Archive
don't undersand sscanf - 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: don't undersand sscanf (/showthread.php?tid=424095)



don't undersand sscanf - ancezas - 20.03.2013

have this CMD and it's showing that i'm offline when i'm online, in mysql showing that i'm online but when type this cmd showing that i'm offline



pawn Код:
CMD:adminai(playerid, params[])
{
    new
        Index,
        query[ 300 ],
        str  [ 1200 ]
    ;

    mysql_query( "SELECT `Vardas`,`Admin`,`Online` FROM `vartotojai` WHERE `Admin` >  '0'" );
    mysql_store_result();
    if ( mysql_num_rows( ))
    {
        while( mysql_fetch_row( query ))
        {
            new
                name[ MAX_PLAYER_NAME ],
                adminid,
                OnlineEx;

            sscanf( query, "p<|>s[24]ii", name, adminid, OnlineEx );


            if ( !OnlineEx )
            {
                format( str, 1200, "{FFFFFF}%s%s - {FF0000}OFFLINE\n{FFFFFF}", str, name );
                Index++;
            }
            else
            {
                format( str, 1200, "{FFFFFF}%s%s - {00FF00}ONLINE\n{FFFFFF}", str, name );
                Index++;
            }
        }
    }
    mysql_free_result();
    if ( !Index )
    {
        ShowPlayerDialog( playerid, 7, DIALOG_STYLE_MSGBOX, "{FF0000}Administratoriai", "{FF0000}Atsiprasome siuo metu nera isrinktas nei vienas administratorius!", "Gerai", "" );
    }
    else
    {
        ShowPlayerDialog( playerid, 8, DIALOG_STYLE_MSGBOX, "{00FF00}Administratoriai", str, "Gerai", "" );
    }
    return 1;
}