17.03.2015, 13:20
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;
}