27.04.2015, 15:09
Quote:
passei 2 so para vc ver 2 codigos,agora na hora de formatar a strjng vce deve fazer assim
PHP код:
vc pode usar esta include tambem e formatar a data a seu gosto https://sampforum.blast.hk/showthread.php?tid=347605 |
pawn Код:
format(String, sizeof(String), "{FFFFFF}» Tempo Online: {32CD32}%s",Convert(ContaPlayer[playerid][TempoOn]));
CODIGO FICO ASSIM:
pawn Код:
forward TempoOnline();
public TempoOnline()
{
for(new i = 0; i < MAX_PLAYERS; i++)
{
if(IsPlayerConnected(i))
{
if(Logado[i] == true)
{
ContaPlayer[i][TempoOn]++;
}
}
}
return 1;
}
ConvertUnix(Time:tempo)
{
new tm <tmTempo>;
new str[100];o
localtime(tempo, tmTempo);
strftime(str, sizeof(str), "%H:%M %d/%m/%Y", tmTempo);
return str;
}
Convert(numero)
{
new hours = 0, mins = 0, secs = 0, string[100];
hours = floatround(numero / 3600);
mins = floatround((numero / 60) - (hours * 60));
secs = floatround(numero - ((hours * 3600) + (mins * 60)));
new days = 0;
if(hours >= 24)
{
days = floatround((hours/24), floatround_floor);
hours = hours % 24;
}
if(days > 0)
{
format(string, 100, "%d, %dh %dm e %ds", days, hours, mins, secs);
}
else if(hours > 0)
{
format(string, 100, "%dh %dm e %ds", hours, mins, secs);
}
else
{
format(string, 100, "%dm e %ds", mins, secs);
}
return string;
}