YCMD:members(playerid, params[], help)
{
#pragma unused help
new string[50];
if(PlayerInfo[playerid][pMember] < 1) return SendClientMessage(playerid, COLOR_ERROR, "You are not in faction.");
new teamnumber;
if(PlayerInfo[playerid][pMember] != 0) teamnumber = PlayerInfo[playerid][pMember];
SendClientMessage(playerid, 0x00FF00FF, "List of faction members:");
new DB_Query[250];
mysql_format(Database, DB_Query, sizeof(DB_Query), "SELECT * FROM `PLAYERS` WHERE `Member` = %d LIMIT 1", teamnumber);
mysql_tquery(Database, DB_Query, "CheckOrgPlayers", "ii", playerid, teamnumber);
return 1;
}
forward public CheckOrgPlayers(playerid, teamnumber);
public CheckOrgPlayers(playerid, teamnumber)
{
if(cache_num_rows() > 0)
{
for(new i; i < cache_num_rows(); i++)
{
new string[50];
new Nick[24], Rank, Status;
cache_get_value(0, "Name", Nick, 24);
cache_get_value_int(0, "Rank", Rank);
cache_get_value_int(0, "LoggedIn", Status);
if(Status == 0)
{
format(string, sizeof(string), " %s (%d) OFFLINE", Nick, Rank);
SendClientMessage(playerid, -1, string);
}
else if(Status == 1)
{
format(string, sizeof (string)," %s (%d) ONLINE", Nick, Rank);
SendClientMessage(playerid, -1, string);
}
}
}
else
{
print("Couldn't find anything.");
}
return 1;
}
PHP код:
|
PHP код:
|
PHP код:
|
Thanks, new to mysql so I make stupid mistakes...
Now command prints 3 times same Nick and same Rank. But I have at least 3 different player names that are in same faction. |
cache_get_value(0, "Name", Nick, 24);
cache_get_value_int(0, "Rank", Rank);
cache_get_value_int(0, "LoggedIn", Status);
cache_get_value(i, "Name", Nick, 24);
cache_get_value_int(i, "Rank", Rank);
cache_get_value_int(i, "LoggedIn", Status);