[HELP]Command -
Markoni990 - 08.03.2015
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.
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;
}
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
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
BUMP
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
Here is the picture who show me dialog, but don`t show me how long player was on the server
http://prntscr.com/6edcmd
PHP код:
new mins, hour, day;
new aktivnost[1024];
new sendernames[MAX_PLAYER_NAME];
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, GetPlayerName(playerOnlineTimes[place][0], sendernames, sizeof(sendernames)));
}
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;
}
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
BUMP
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
HELP PLEASE
Re: [HELP]Command -
Passmerd - 08.03.2015
There is no "problems" in the code as I can see, Might be "Because there is no users in your database".
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
but we will not time down and tell me for each particular player shows the name
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
now works but not the time to update
PHP код:
OnPlayerConnect(playerid)
{
PlayerInfo[playerid][pConnectTime] = gettime();
}
PHP код:
stock ConvertTime(&cts, &ctm=-1,&cth=-1,&ctd=-1,&ctw=-1,&ctmo=-1,&cty=-1) //Thanks to Kyosaur
{
#define PLUR(%0,%1,%2) (%0),((%0) == 1)?((#%1)):((#%2))
#define CTM_cty 31536000
#define CTM_ctmo 2628000
#define CTM_ctw 604800
#define CTM_ctd 86400
#define CTM_cth 3600
#define CTM_ctm 60
#define CT(%0) %0 = cts / CTM_%0; cts %= CTM_%0
new strii[128];
if(cty != -1 && (cts/CTM_cty))
{
CT(cty); CT(ctmo); CT(ctw); CT(ctd); CT(cth); CT(ctm);
format(strii, sizeof(strii), "%d %s, %d %s, %d %s, %d %s, %d %s, %d %s, and %d %s",PLUR(cty,"year","years"),PLUR(ctmo,"month","months"),PLUR(ctw,"week","weeks"),PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
return strii;
}
if(ctmo != -1 && (cts/CTM_ctmo))
{
cty = 0; CT(ctmo); CT(ctw); CT(ctd); CT(cth); CT(ctm);
format(strii, sizeof(strii), "%d %s, %d %s, %d %s, %d %s, %d %s, and %d %s",PLUR(ctmo,"month","months"),PLUR(ctw,"week","weeks"),PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
return strii;
}
if(ctw != -1 && (cts/CTM_ctw))
{
cty = 0; ctmo = 0; CT(ctw); CT(ctd); CT(cth); CT(ctm);
format(strii, sizeof(strii), "%d %s, %d %s, %d %s, %d %s, and %d %s",PLUR(ctw,"week","weeks"),PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
return strii;
}
if(ctd != -1 && (cts/CTM_ctd))
{
cty = 0; ctmo = 0; ctw = 0; CT(ctd); CT(cth); CT(ctm);
format(strii, sizeof(strii), "%d %s, %d %s, %d %s, and %d %s",PLUR(ctd,"day","days"),PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
return strii;
}
if(cth != -1 && (cts/CTM_cth))
{
cty = 0; ctmo = 0; ctw = 0; ctd = 0; CT(cth); CT(ctm);
format(strii, sizeof(strii), "%d %s, %d %s, and %d %s",PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
return strii;
}
if(ctm != -1 && (cts/CTM_ctm))
{
cty = 0; ctmo = 0; ctw = 0; ctd = 0; cth = 0; CT(ctm);
format(strii, sizeof(strii), "%d %s, and %d %s",PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
return strii;
}
cty = 0; ctmo = 0; ctw = 0; ctd = 0; cth = 0; ctm = 0;
format(strii, sizeof(strii), "%d %s", PLUR(cts,"second","seconds"));
return strii;
}
days 0 hours 0 minutes 0 sec 0 no update time Anybody know what's up?
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
Respuesta: [HELP]Command -
Markoni990 - 08.03.2015
BUMP