SA-MP Forums Archive
creating a last logged command - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: creating a last logged command (/showthread.php?tid=616432)



creating a last logged command - yvoms - 04.09.2016

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)


Re: creating a last logged command - SickAttack - 04.09.2016

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.


Re: creating a last logged command - JordanZaundd - 04.09.2016

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.


Re: creating a last logged command - yvoms - 05.09.2016

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.


Re: creating a last logged command - Gammix - 05.09.2016

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.



Re: creating a last logged command - yvoms - 06.09.2016

Gammix i love you.