Help with Online/Offline in dialog.
#1

Hello there, i wanted to make a dialog to show all admins
from the server, even they are not Online. Well when they will be logged in
in dialog will Show Admin X - Online if the admin is offline in dialog will show
Admin X - Offilne, if he is in a Minigame/DM will show Admin X - Playing and
if the admin is AFK will show Admin X - Away from Keyboard. But when i connect
with my name: FaLLenGirL, there appears Online to another name that is not connected..


< PHOTO >


Can u help ? Thx .
Reply
#2

Try this;

PHP код:
CMD:admins(playeridparams[]) {

    
ListPage[playerid] = 0;
    
eBigString[0] = EOS;

    new 
Cache:adminslogquery[120];
    
adminslog mysql_query(DB_Connect"SELECT Name, Level, LoggedIn, LastOn FROM Accounts WHERE Level > 0 ORDER BY Level DESC LIMIT 0, 15");

    new 
rows cache_num_rows();

    if(
rows) {

        new 
OnName[MAX_PLAYER_NAME+1], ALevelAdmRank[35], StatusPlayer[60], LastOnline[30];
        
eBigString "{FFFFFF}#.\t{FFFFFF}Admin Name\t{FFFFFF}Rank(Level)\t{FFFFFF}Status\n";

        for(new 
irowsi++) {

            
cache_get_field_content(i"Name"OnName );
            
cache_get_field_content(i"LastOn"LastOnline );
             
ALevel cache_get_field_content_inti"Level" );

             new 
isOnline GetID(OnName);

             if(
IsPlayerConnected(isOnline) && PlayerInfo[isOnline][AFK] == 0Status_Player "{00CC00}• {FFFFFF}Online";
             if(
PlayerInfo[isOnline][AFK] == 1Status_Player "{DB881A}• {FFFFFF}Away from Keyboard";
             if( 
PlayerInfo[isOnline][ InDM ] == || PlayerInfo[isOnline][ InMG ][ ] == || PlayerInfo[isOnline][ InMG ][ ] == || PlayerInfo[isOnline][ InMG ][ ] == ||
            
Joined[isOnline] == true || Snow_F[isOnline] == Status_Player "{FF0000}• {FFFFFF}Playing";

             switch( 
ALevel )
            {
                case 
1AdmRank "{CC6633}Trial-Helper";
                case 
2AdmRank "{3371CC}Basic-Helper";
                case 
3AdmRank "{3371CC}Master-Helper";
                case 
4AdmRank "{33FF99}Moderator";
                case 
5AdmRank "{33FF00}Basic-Moderator";
                case 
6AdmRank "{996600}Master-Moderator";
                case 
7AdmRank "{FF9900}Administrator";
                case 
8AdmRank "{CCFF00}Basic-Administrator";
                case 
9AdmRank "{FFCC00}Master-Administrator";
                case 
10AdmRank "{FF0000}Owner";
            }

            if( 
PlayerInfo[isOnline][ LoggedIn ] == formateBigStringsizeofeBigString ), "%s{FFFFFF}#.\t{C0C0C0}%s\t%s(%d)\t%s\n"eBigStringOnNameAdmRankALevelStatus_Player );
            else 
formateBigStringsizeofeBigString ), "%s{FFFFFF}#.\t{C0C0C0}%s\t%s(%d)\t{C0C0C0}%s\n"eBigStringOnNameAdmRankALevelLastOnline );
        }
        
ShowPlayerDialogplayeridDIALOG_ADMINS_NEXTDIALOG_STYLE_TABLIST_HEADERS"{FFFFFF}Server Administrators: Page 1:"eBigString"Next""Exit" );
    }
    else 
SendErrorplayerid"There are no Server Administrators !" );
    
cache_deleteadminslog );
    return 
1;
}

GetID(name[])
{
    for(new 
iGetPlayerPoolSize(); <= ji++)
    {
        new 
playeRname[MAX_PLAYER_NAME+1];
        
GetPlayerName(iplayeRnamesizeof(playeRname));

        if(!
strcmp(GetName(i), nametrue)) return i;
    }
    return 
INVALID_PLAYER_ID;

Reply
#3

Thx. I solved in other way. But it is okey too what you have done for me.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)