creating a last logged command
#1

I'm in need of help, i would like a command that returns the last time a player logged in as following
/lastlogged [playerid]

output :
[server] X has logged in %d days, % hours, and % minutes ago.

CMD:lastlogged(playerid, params[])
{

return 1;
}

I have made a column in my player database called LastLogged, which is TIMESTAMP(Onupdate CurrentTimestamp)
Reply
#2

What do you need help with? You already have the timestamp, it's far simple from there (minus arithmetic operator).

I remind you that this section isn't for requests.
Reply
#3

Load the timestamp into a string and then paste it into SendClientMessage

PHP код:
 //Load timestamp into "new date;" from sql or .ini, whichever you have. 
new str[64], name[MAX_PLAYER_NAME];
GetPlayerName(targetidnameMAX_PLAYER_NAME);
format(strsizeof(str), "[SERVER]: %s was last seen on %s"namedate);
SendClientMessage(playeridcolor,  str); 
However this way it does not tell you specifically how many days, hours, minutes it has been.
Reply
#4

i know how to print the date, hour, minute, secconds.
But i would like to get the player's time - Server's time = x Days X hours X Minutes = Output.
So it would basically show the last logged time of the player in days Hours and minutes.
Reply
#5

http://forum.sa-mp.com/showpost.php?...postcount=4588

pawn Код:
printf("[server] X has logged in %s.", ReturnTimelapse(timestamp_when_player_logged, gettime());
Sample:
pawn Код:
[server] X has logged in a minute ago.
Reply
#6

Gammix i love you.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)