Mysql selecting all players that have certain variable
#1

I want to print all members from certain faction. This what I will post works but it prints only one player from database. I think callback CheckOrgPlayers isn't working properly.

PHP код:
YCMD:members(playeridparams[], help)
{
    
#pragma unused help
    
new string[50];
    if(
PlayerInfo[playerid][pMember] < 1) return SendClientMessage(playeridCOLOR_ERROR"You are not in faction.");
    new 
teamnumber;
    if(
PlayerInfo[playerid][pMember] != 0teamnumber PlayerInfo[playerid][pMember];
    
SendClientMessage(playerid0x00FF00FF"List of faction members:");
    new 
DB_Query[250];
    
mysql_format(DatabaseDB_Querysizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `Member` = %d LIMIT 1"teamnumber);
    
mysql_tquery(DatabaseDB_Query"CheckOrgPlayers""ii"playeridteamnumber);
     
    return 
1;

PHP код:
forward public CheckOrgPlayers(playeridteamnumber);
public 
CheckOrgPlayers(playeridteamnumber)
{
    if(
cache_num_rows() > 0)
    {
        for(new 
icache_num_rows(); i++)
        {
            new 
string[50];
            new 
Nick[24], RankStatus;
            
cache_get_value(0"Name"Nick24);
            
cache_get_value_int(0"Rank"Rank);
            
cache_get_value_int(0"LoggedIn"Status);
            if(
Status == 0)
            {
                
format(stringsizeof(string), "    %s (%d) OFFLINE"NickRank);
                
SendClientMessage(playerid, -1string);
            }
            else if(
Status == 1)
            {
                
format(stringsizeof (string),"    %s (%d) ONLINE"NickRank);
                
SendClientMessage(playerid, -1string);
            }
           
         }
  
    }    
    else
    {
        print(
"Couldn't find anything.");
    }
    return 
1;

Reply


Messages In This Thread
Mysql selecting all players that have certain variable - by Saddin - 16.05.2017, 16:42
Re: Mysql selecting all players that have certain variable - by Vince - 16.05.2017, 16:44
Re: Mysql selecting all players that have certain variable - by JaKe Elite - 16.05.2017, 16:45
Re: Mysql selecting all players that have certain variable - by Saddin - 16.05.2017, 16:49
Re: Mysql selecting all players that have certain variable - by Saddin - 16.05.2017, 17:01

Forum Jump:


Users browsing this thread: 5 Guest(s)