25.12.2018, 08:26
PHP код:
IRCCMD:topplayers(botid, channel[], user[], host[], params[])
{
new _query[180], fetchedName[MAX_PLAYER_NAME], lastseen[40], activity, Cache:results;
results = mysql_query(handle, "SELECT `Username`, `Activity`, `LastLoggedIn` FROM `accounts` ORDER BY `Activity` DESC LIMIT 10");
IRC_GroupSay(gGroupID, channel, "00,12-----[Top 10 monthly active players]-----");
for(new Qr, rows = cache_num_rows(); Qr<rows; Qr++)
{
cache_get_value_name(Qr, "Username", fetchedName);
cache_get_value_name_int(Qr, "Activity", activity);
cache_get_value_name(Qr, "LastLoggedIn", lastseen);
format(_query, sizeof(_query), "\x020,12 #%d\x02 - Username: \x1D%s\x1D Last seen at: \x1D%s\x1D Activity: \x1D%d\x1D minute(s)", Qr+1, fetchedName, lastseen, activity / 60);
IRC_GroupSay(gGroupID, channel, _query);
}
IRC_GroupSay(gGroupID, channel, "00,12-----------------------------------------");
cache_delete(results);
return 1;
}