Автор: ZzAQ: Дата: 06.12.2008
AtCommand_Online,
ACMD_FUNC(online);
{ AtCommand_Online, "@online", 1, atcommand_online},
int atcommand_online(const int fd, struct map_session_data* sd, const char* command, const char* message)
{
struct map_session_data *pl_sd, **pl_allsd;
int i, count, users;
int pl_GM_level, GM_level;
int map_id = 0;
char map_name[MAP_NAME_LENGTH];
nullpo_retr(-1, sd);
memset(atcmd_output, '\', sizeof(atcmd_output));
if (!message || !*message)
map_id = sd->bl.m;
else {
sscanf(message, "%15s", map_name);
if (strstr(map_name, ".gat") == NULL && strstr(map_name, ".afm") == NULL && strlen(map_name) < MAP_NAME_LENGTH-4) // 16 - 4 (.gat)
strcat(map_name, ".gat");
if ((map_id = map_mapname2mapid(map_name)) < 0)
map_id = sd->bl.m;
}
count = 0;
GM_level = pc_isGM(sd);
pl_allsd = map_getallusers(&users);
for (i = 0; i < users; i++) {
if ((pl_sd = pl_allsd)) {
pl_GM_level = pc_isGM(pl_sd);
if (!((battle_config.hide_GM_session || (pl_sd->sc.option & OPTION_INVISIBLE)) && (pl_GM_level > GM_level))) {
if (pl_sd->bl.m == map_id)
{
count++;
}
}
}
}
sprintf(atcmd_output, msg_txt(460), count); // %d players found in map '%s'.
clif_displaymessage(fd, atcmd_output);
return 0;
}
460: Игроков на карте: %d
Автор: : Дата: 01.01.1970