[HELP]Command
#1

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(),
        
0
    
;
    foreach(
Playerpid)
    {
        if(
Prijavljen[pid])
        {
            
playerOnlineTimes[i][0] = pid;
            
playerOnlineTimes[i][1] = clamp(currentTime PlayerInfo[pid][pConnectTime], 0);
            
i++;
        }
    }
    
SortDeepArray(playerOnlineTimes1, .order SORT_DESC);
    new 
minshourday;
    new 
aktivnost[1024];
    
    
format(aktivnost,1024,"%s{FF0000}|----------------------------------------------------------------------|\n\n",aktivnost);
    for(new 
place 0place != 30; ++place)
    {
        if (
== playerOnlineTimes[place][1]) {
            break;
        }
        
ConvertTime(playerOnlineTimes[place][1], minshourday);
        
format(aktivnost,1024,"%s{FFFFFF}%d.%s:%d dana %d h %d min %d sec\n",aktivnost,place 1dayhourminsplayerOnlineTimes[place][0]);
    }
    
format(aktivnost,1024,"%s{FF0000}|----------------------------------------------------------------------|\n\n",aktivnost);
    
ShowPlayerDialog(playerid713DIALOG_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
Reply
#2

BUMP
Reply
#3

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 minshourday;
    new 
aktivnost[1024];
    new 
sendernames[MAX_PLAYER_NAME];
    
    
format(aktivnost,1024,"%s{FF0000}|----------------------------------------------------------------------|\n\n",aktivnost);
    for(new 
place 0place != 30; ++place)
    {
    
/*if (0 == playerOnlineTimes[place][1]) {
    break;
    }*/
    
ConvertTime(playerOnlineTimes[place][1], minshourday);
    
format(aktivnost,1024,"%s{FFFFFF}%d.%s:%d dana %d h %d min %d sec\n",aktivnost,place 1dayhourminsGetPlayerName(playerOnlineTimes[place][0], sendernamessizeof(sendernames)));
    }
    
format(aktivnost,1024,"%s{FF0000}|----------------------------------------------------------------------|\n\n",aktivnost);
    
ShowPlayerDialog(playerid713DIALOG_STYLE_MSGBOX"{FF0000}GAMING {FFFFFF} Top Lista 30 sa najvise ne-afk vreme na serveru"aktivnost"OK""OK");
    return 
1;

Reply
#4

BUMP
Reply
#5

HELP PLEASE
Reply
#6

There is no "problems" in the code as I can see, Might be "Because there is no users in your database".
Reply
#7

but we will not time down and tell me for each particular player shows the name
Reply
#8

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 != -&& (cts/CTM_cty))
    {
        
CT(cty); CT(ctmo); CT(ctw); CT(ctd); CT(cth); CT(ctm);
        
format(striisizeof(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 != -&& (cts/CTM_ctmo))
    {
        
cty 0CT(ctmo); CT(ctw); CT(ctd); CT(cth); CT(ctm);
        
format(striisizeof(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 != -&& (cts/CTM_ctw))
    {
        
cty 0ctmo 0CT(ctw); CT(ctd); CT(cth); CT(ctm);
        
format(striisizeof(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 != -&& (cts/CTM_ctd))
    {
        
cty 0ctmo 0ctw 0CT(ctd); CT(cth); CT(ctm);
        
format(striisizeof(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 != -&& (cts/CTM_cth))
    {
        
cty 0ctmo 0ctw 0ctd 0CT(cth); CT(ctm);
        
format(striisizeof(strii), "%d %s, %d %s, and %d %s",PLUR(cth,"hour","hours"),PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
        return 
strii;
    }
    if(
ctm != -&& (cts/CTM_ctm))
    {
        
cty 0ctmo 0ctw 0ctd 0cth 0CT(ctm);
        
format(striisizeof(strii), "%d %s, and %d %s",PLUR(ctm,"minute","minutes"),PLUR(cts,"second","seconds"));
        return 
strii;
    }
    
cty 0ctmo 0ctw 0ctd 0cth 0ctm 0;
    
format(striisizeof(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?
Reply
#9

Reply
#10

BUMP
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)