[HELP] Activity for player
#1

He wanted make command activity for players online and offline, but I pretended not to expel me if the name of the player offline just eject the current player who is online on the server.

PHP код:
enum pInfo
            pDani
,
            
pMinutes,
            
pHours,
            
pSeconds
new PlayerInfo[MAX_PLAYERS][pInfo]; 
PHP код:
                format(var, 64"Dani=%d\n",PlayerInfo[playerid][pDani]);fwrite(hFile, var);
                
format(var, 64"Minutes=%d\n",PlayerInfo[playerid][pMinutes]);fwrite(hFile, var);
                
format(var, 64"Hours=%d\n",PlayerInfo[playerid][pHours]);fwrite(hFile, var);
                
format(var, 64"Seconds=%d\n",PlayerInfo[playerid][pSeconds]);fwrite(hFile, var); 
PHP код:
public OnPlayerConnect(playerid)
{
    
SetTimerEx("Aktivnost"1000true"i"playerid);

PHP код:
forward Aktivnost();
public 
Aktivnost()
{
    foreach (
Playeri)
    {
        
PlayerInfo[i][pSeconds] += 1;
        if (
PlayerInfo[i][pSeconds] == 60)
        {
            
PlayerInfo[i][pMinutes] += 1;
            
PlayerInfo[i][pSeconds] = 0;
        }
        if (
PlayerInfo[i][pMinutes] == 60)
        {
            
PlayerInfo[i][pHours] += 1;
            
PlayerInfo[i][pMinutes] = 0;
        }
        if (
PlayerInfo[i][pHours] == 24)
        {
            
PlayerInfo[i][pDani] += 1;
            
PlayerInfo[i][pHours] = 0;
        }
    }
    return 
1;

PHP код:
CMD:aktivnost(playerid,params[])
{
 new 
aktivnost[2024];      format(aktivnost,2024,"%s{FF0000}|----------------------------------------------------------------------|\n",aktivnost);
   for(new 
place 0place != 30; ++place)
    {
    new 
Days PlayerInfo[place][pDani];
    new 
Hours PlayerInfo[place][pHours];
    new 
Minutes PlayerInfo[place][pMinutes];
    new 
Seconds PlayerInfo[place][pSeconds];//
    
format(aktivnost,2024,"%s{FF0000}%d. {FFFFFF}%s: %d dana %d h %d min %d sec\n",aktivnost,place 1,ImeIgracaaa(place),DaysHoursMinutesSeconds);
    }
    
format(aktivnost,2024,"%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
#2

Quote:
Originally Posted by Markoni990
Посмотреть сообщение
He wanted make command activity for players online and offline, but I pretended not to expel me if the name of the player offline just eject the current player who is online on the server.

PHP код:
enum pInfo
            pDani
,
            
pMinutes,
            
pHours,
            
pSeconds
new PlayerInfo[MAX_PLAYERS][pInfo]; 
PHP код:
                format(var, 64"Dani=%d\n",PlayerInfo[playerid][pDani]);fwrite(hFile, var);
                
format(var, 64"Minutes=%d\n",PlayerInfo[playerid][pMinutes]);fwrite(hFile, var);
                
format(var, 64"Hours=%d\n",PlayerInfo[playerid][pHours]);fwrite(hFile, var);
                
format(var, 64"Seconds=%d\n",PlayerInfo[playerid][pSeconds]);fwrite(hFile, var); 
PHP код:
public OnPlayerConnect(playerid)
{
    
SetTimerEx("Aktivnost"1000true"i"playerid);

PHP код:
forward Aktivnost();
public 
Aktivnost()
{
    foreach (
Playeri)
    {
        
PlayerInfo[i][pSeconds] += 1;
        if (
PlayerInfo[i][pSeconds] == 60)
        {
            
PlayerInfo[i][pMinutes] += 1;
            
PlayerInfo[i][pSeconds] = 0;
        }
        if (
PlayerInfo[i][pMinutes] == 60)
        {
            
PlayerInfo[i][pHours] += 1;
            
PlayerInfo[i][pMinutes] = 0;
        }
        if (
PlayerInfo[i][pHours] == 24)
        {
            
PlayerInfo[i][pDani] += 1;
            
PlayerInfo[i][pHours] = 0;
        }
    }
    return 
1;

PHP код:
CMD:aktivnost(playerid,params[])
{
 new 
aktivnost[2024];      format(aktivnost,2024,"%s{FF0000}|----------------------------------------------------------------------|\n",aktivnost);
   for(new 
place 0place != 30; ++place)
    {
    new 
Days PlayerInfo[place][pDani];
    new 
Hours PlayerInfo[place][pHours];
    new 
Minutes PlayerInfo[place][pMinutes];
    new 
Seconds PlayerInfo[place][pSeconds];//
    
format(aktivnost,2024,"%s{FF0000}%d. {FFFFFF}%s: %d dana %d h %d min %d sec\n",aktivnost,place 1,ImeIgracaaa(place),DaysHoursMinutesSeconds);
    }
    
format(aktivnost,2024,"%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;

Firstly, never have a string that big. It will never be necessary to have a string sized 2024. Change the size of the string to 128 or you will have problems in the long run.

Secondly, can you explain what you want? I cant really understand from your description. You might want to post this in a section suitable for your first language.
Reply
#3

This is how I want to do the activity for players on the server but when a player is not online to show his time if there is more than anyone, but to be in the top30
Reply
#4

BUMP! Help please
Reply
#5

BUMP!
Reply
#6

BUMP!
Reply
#7

BUMP PLEASE!
Reply
#8

BUMP
Reply
#9

BUMP!
Reply
#10

I suggest that you use SQL, going with files to do such a thing is just a terrible idea.

With SQL you can order a query, example:
pawn Код:
SELECT * FROM `%s` ORDER BY (`%s` * 1) DESC LIMIT %d, %d
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)