19.08.2018, 13:51
Hello, i have this stock:
And i use in this way:
Basically, the GetDuration stock should return how much time passed since something. I used to check how much time passed since registration date of the player.
But ingame it says: Creation: 48 yeard ago. Wtf?
P.S The RegisterDate row saves CORRECTLY the registration time/date
pawn Код:
stock GetDuration(time)
{
new str[32];
if (time < 0 || time == gettime())
{
format(str, sizeof(str), "Never");
return str;
}
else if (time < 60)
format(str, sizeof(str), "%d seconds", time);
else if (time >= 0 && time < 60)
format(str, sizeof(str), "%d seconds", time);
else if (time >= 60 && time < 3600)
format(str, sizeof(str), (time >= 120) ? ("%d minutes") : ("%d minute"), time / 60);
else if (time >= 3600 && time < 86400)
format(str, sizeof(str), (time >= 7200) ? ("%d hours") : ("%d hour"), time / 3600);
else if (time >= 86400 && time < 2592000)
format(str, sizeof(str), (time >= 172800) ? ("%d days") : ("%d day"), time / 86400);
else if (time >= 2592000 && time < 31536000)
format(str, sizeof(str), (time >= 5184000) ? ("%d months") : ("%d month"), time / 2592000);
else if (time >= 31536000)
format(str, sizeof(str), (time >= 63072000) ? ("%d years") : ("%d year"), time / 31536000);
strcat(str, " ago");
return str;
}
pawn Код:
new createDate;
cache_get_value_int(0, "RegisterDate", createDate);
new string[128];
format(string, sizeof(string), "Creation: %s", GetDuration(gettime() - createDate));
SendClientMessage(playerid, -1, string);
But ingame it says: Creation: 48 yeard ago. Wtf?
P.S The RegisterDate row saves CORRECTLY the registration time/date