How to get a players IP and account creation time?
#1

Title says it, I am using MySQL and was wonderin how I would store a players IP and use it for when they logged in?

Ex: Windows32 [Last Login: DATEHERE ; IP HERE]

Thanks.
Reply
#2

pawn Код:
format (string,sizeof(string)," Player %s joined the server [ Last Login: %s  ; IP : %s]",GetPlayerName(bla bla),GetLastLogin ,GetPlayerIp(bla bla));
Reply
#3

Urm, No.

"GetLastLogin"? Im not a retard, I know how to string it all together, It's the functions and that.
Reply
#4

GetLastLogin is not a function.Try something like
Код:
new pname[25];
new var[256];
new y,m,d,h,mi,s;
getdate(y,m,d);
gettime(h,mi,s);
GetPlayerName(playerid,pname,25);
format(var, 256, "UPDATE `YOUR TABLE` SET `lastOn`='%d/%d/%d %d:%d:%d' WHERE `name`='%s'",d,m,y,h,mi,s,pname);
mysql_query(var);
And then use it to OnPlayerConnect,same with IP you have the function to get player ip,GetPlayerIp(playerid)
Reply
#5

My string was just example I didnt meant Get last login is function....Sorry
Reply
#6

In mysql you can give a timestamp column a default value "CURRENT_TIMESTAMP" if you do that and never alter the column that will store the joindate. The columns type must be timestamp.


EDIT: For some weird reason i thought you wanted it for joindate. I really don't know why
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)