SA-MP Forums Archive
Problem with command - 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: Problem with command (/showthread.php?tid=486739)



Problem with command - MadafakaPro - 10.01.2014

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;
}



Re: Problem with command - Tingesport - 10.01.2014

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


Re: Problem with command - MadafakaPro - 10.01.2014

So i should add IsPlayerConnected?


Re: Problem with command - Tingesport - 10.01.2014

Yes, make a for loop.

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