Problem with command
#1

Its made to show the offline members but its showing the players even they are online it shows them that they are online
Whats wrong here?
pawn Код:
COMMAND:foff(playerid)
{
    if(PlayerInfo[playerid][playerteam] == CIV || PlayerInfo[playerid][playerteam] == 0)
        return SendClientError(playerid, "You cannot use this as civilian.");
        format(iStr, sizeof(iStr), "[FACTION] OFFLINE %s members:", PlayerInfo[playerid][PTeamName]);
        SendClientMessage(playerid, COLOR_HELPEROOC, iStr);
        new szQuery[ 128 ], tmp[80];
        format(szQuery, sizeof(szQuery), "SELECT Name, Faction, rankname, Fpay FROM `players` WHERE Faction='%s'", PlayerInfo[playerid][PTeamName]);
        mysql_query(szQuery);
        mysql_store_result();
        while( mysql_fetch_row_format( iStr,"|") )
        {
                new eName[ 32 ], eFaction[ 32 ], eRank[ 32 ], ePay;
                sscanf( iStr , "sssd" , eName, eFaction, eRank, ePay);
                if(GetPlayerId(eName) == INVALID_PLAYER_ID)
                {
                    format(tmp, sizeof(tmp), "* %s - [Rank: %s] [Payment: $%s] [Offline]", NoUnderscore(eName), eRank, number_format(ePay));
                    SendClientMessage(playerid, COLOR_PLAYER_DARKGREY, tmp);
                }
        }
        mysql_free_result();
        return 1;
}
Reply
#2

You are not even checking if wether they're offline or online?
Reply
#3

So i should add IsPlayerConnected?
Reply
#4

Yes, make a for loop.

pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
{
      if(!IsPlayerConnected)
      {
             // CODE
      }
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)