05.01.2016, 01:33
Tente utilizar dessa forma, nгo testei. Talvez funcione.
PHP код:
new TempoOnline[MAX_PLAYERS], TempoTotalOnline[MAX_PLAYERS];
public OnPlayerConnect(playerid)
{
new str[30],
key = DB::RetrieveKey(gGlobal[TKT_UserTable], "username", tkPlayerName(playerid));
TempoTotalOnline[playerid] = DB::GetIntEntry(gGlobal[TKT_UserTable], key, "tempo_online");
new hora = (TempoTotalOnline[playerid] / (60 * 60)),
minuto = (TempoTotalOnline[playerid] / 60) % 60,
segundo = TempoTotalOnline[playerid] % 60,
format(str, 30, "%d:%d:%dhrs", hora, minuto, segundo);
SendClientMessage(playerid, -1, str);
TempoOnline[playerid] = gettime();
return 1;
}
public OnPlayerDisconnect(playerid)
{
new key = DB::RetrieveKey(gGlobal[TKT_UserTable], "username", tkPlayerName(playerid));
DB::SetIntEntry(gGlobal[TKT_UserTable], key, "tempo_online", (gettime() - TempoOnline[playerid]) + TempoTotalOnline[playerid]);
return 1;
}