08.03.2015, 19:09
there is any way to record the total played time for each player and showing into activity top 30 player?
I write /activity : The most active players on server no afk
Total time played: XX days / XX minutes / XX seconds
Thanks.
Here is the picture who show me dialog, but don`t show me how long player was on the server http://prntscr.com/6dwtal this should show http://prntscr.com/6ecdm0
I write /activity : The most active players on server no afk
Total time played: XX days / XX minutes / XX seconds
Thanks.
PHP код:
enum pInfo
{
pMinutes,
pHours,
pSeconds,
pConnectTime
};
new PlayerInfo[MAX_PLAYERS][pInfo];
PHP код:
new Prijavljen[MAX_PLAYERS];
PHP код:
OnPlayerConnect(playerid)
{
PlayerInfo[playerid][pConnectTime] = gettime();
}
PHP код:
CMD:test(playerid,params[])
{
new
playerOnlineTimes[MAX_PLAYERS][2],
currentTime = gettime(),
i = 0
;
foreach(Player, pid)
{
if(Prijavljen[pid])
{
playerOnlineTimes[i][0] = pid;
playerOnlineTimes[i][1] = clamp(currentTime - PlayerInfo[pid][pConnectTime], 0);
i++;
}
}
SortDeepArray(playerOnlineTimes, 1, .order = SORT_DESC);
new mins, hour, day;
new aktivnost[1024];
format(aktivnost,1024,"%s{FF0000}|----------------------------------------------------------------------|\n\n",aktivnost);
for(new place = 0; place != 30; ++place)
{
if (0 == playerOnlineTimes[place][1]) {
break;
}
ConvertTime(playerOnlineTimes[place][1], mins, hour, day);
format(aktivnost,1024,"%s{FFFFFF}%d.%s:%d dana %d h %d min %d sec\n",aktivnost,place + 1, day, hour, mins, playerOnlineTimes[place][0]);
}
format(aktivnost,1024,"%s{FF0000}|----------------------------------------------------------------------|\n\n",aktivnost);
ShowPlayerDialog(playerid, 713, DIALOG_STYLE_MSGBOX, "{FF0000}GAMING {FFFFFF} Top Lista 30 sa najvise ne-afk vreme na serveru", aktivnost, "OK", "OK");
return 1;
}