16.01.2014, 00:03
pawn Код:
new TimeOnline[MAX_PLAYERS][2];
#define LoggedPlayer(%0) \
TimeOnline[%0][0] = gettime(), TimeOnline[%0][1] = 0;
#define LogoutPlayer(%0) \
TimeOnline[%0][1] = gettime();
#define ShowHoursLogged(%0) \
ExtractTime(%0, 0);
#define ShowMinutesLogged(%0) \
ExtractTime(%0, 1);
ExtractTime(playerid, type)
{
new time[3];
if(TimeOnline[playerid][1])
time[0] = TimeOnline[playerid][0]-TimeOnline[playerid][1];
else
time[0] = TimeOnline[playerid][0]-gettime();
time[1] = time[0] / 3600;
time[2] = time[0] / 60 - (time[1] * 60));
return time[type+1];
}
LoggedPlayer(playerid);
Quando Deslogar:
LogoutPlayer(playerid);
Para ver as horas que o jogador estб conectado:
ShowHoursLogged(playerid);
Para ver os minutos que o jogador estб conectado:
ShowMinutesLogged(playerid);
Nгo testei.