[HELP] Activity for player -
Markoni990 - 17.03.2015
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", 1000, true, "i", playerid);
}
PHP код:
forward Aktivnost();
public Aktivnost()
{
foreach (Player, i)
{
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 = 0; place != 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),Days, Hours, Minutes, Seconds);
}
format(aktivnost,2024,"%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;
}
Re: [HELP] Activity for player -
Ciarannn - 17.03.2015
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", 1000, true, "i", playerid);
}
PHP код:
forward Aktivnost();
public Aktivnost()
{
foreach (Player, i)
{
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 = 0; place != 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),Days, Hours, Minutes, Seconds);
}
format(aktivnost,2024,"%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;
}
|
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.
Respuesta: [HELP] Activity for player -
Markoni990 - 17.03.2015
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
Respuesta: [HELP] Activity for player -
Markoni990 - 18.03.2015
BUMP! Help please
Respuesta: [HELP] Activity for player -
Markoni990 - 19.03.2015
BUMP!
Respuesta: [HELP] Activity for player -
Markoni990 - 19.03.2015
BUMP!
Respuesta: [HELP] Activity for player -
Markoni990 - 21.03.2015
BUMP PLEASE!
Respuesta: [HELP] Activity for player -
Markoni990 - 22.03.2015
BUMP
Respuesta: [HELP] Activity for player -
Markoni990 - 22.03.2015
BUMP!
Re: [HELP] Activity for player -
SickAttack - 23.03.2015
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