SendClientMessage(playerid, 0x33AAFFFF, "Члены организации оффлайн:");
format(query, sizeof(query), "SELECT * FROM `accounts` WHERE `u_member` = '%d'",PlayerInfo[playerid][iMember]);
mysql_function_query(MySQL_CONNECT, query, true, "OFFmembers", "d",playerid);
@_ OFFmembers(playerid)
{
new i, temp[32], name[MAX_PLAYER_NAME], rank, playeridd = INVALID_PLAYER_ID;
cache_get_data(rows, fields);
if(rows)
{
for(i = 0; i < rows; i++)
{
cache_get_field_content(i, "u_name", temp), strmid(name, temp,strlen(temp), MAX_PLAYER_NAME);
cache_get_field_content(i, "u_rank", temp), rank = strval(temp);
if(!IsPlayerConnected(playeridd))
{
format(ZCMDstr, sizeof(ZCMDstr),"[L] %s Rank: %d", name, rank);
SendClientMessage(playerid, -1, ZCMDstr);
}
playeridd = INVALID_PLAYER_ID;
}
}
else SendClientMessage(playerid, COLOR_GREY, "Список пуст");
return true;
}
@_ OFFmembers(playerid)
{
new i, temp[32], name[MAX_PLAYER_NAME], rank;
cache_get_data(rows, fields);
if(rows)
{
for(i = 0; i < rows; i++)
{
cache_get_field_content(i, "u_name", temp), strmid(name, temp,strlen(temp), MAX_PLAYER_NAME);
cache_get_field_content(i, "u_rank", temp), rank = strval(temp);
if(!IsPlayerConnected(GetPlayerID(name)))
{
format(ZCMDstr, sizeof(ZCMDstr),"[L] %s Rank: %d", name, rank);
SendClientMessage(playerid, -1, ZCMDstr);
}
}
}
else SendClientMessage(playerid, COLOR_GREY, "Список пуст");
return true;
}
GetPlayerID(string[])
{
foreach (new i : Player)
{
if(strcmp(PlayerName(i), string, true, strlen(string)) == 0) return i;
}
return INVALID_PLAYER_ID;
}
PHP код:
PHP код:
|
@_ OFFmembers(playerid)
{
new temp[32], name[MAX_PLAYER_NAME], rank,dialog[500]; // диалог измени на свое, сделал с "запасом"
new id = cache_get_row_count();
if(id == 0) SendClientMessage(playerid, COLOR_GREY,"Список пуст!");
else
{
for(i = 0; i < id; i++)
{
cache_get_field_content(i, "u_name", temp), strmid(name, temp,strlen(temp), MAX_PLAYER_NAME);
cache_get_field_content(i, "u_rank", temp), rank = strval(temp);
if(!IsPlayerConnected(playeridd))
{
format(dialog,sizeof(dialog,"Ник %s - Ранг %d - Статус %s\n",name, rank, (IsPlayerConnected(GetPlayerID(name))) ? ("Онлайн") : ("Оффлайн"));
}
ShowPlayerDialog(playerid,DIALOG_STYLE_LIST,0,"Список членов организации",dialog,"Окей","");
}
}
return 1;
}
stock GetPlayerID(string[])
{
foreach(new i: Player)
{
if(!IsPlayerConnected(i)) continue;
if(!strcmp(PlayerInfo[i][pName], string, true)) return i;
}
return INVALID_PLAYER_ID;
}