How to get a players IP and account creation time? - 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: How to get a players IP and account creation time? (
/showthread.php?tid=346165)
How to get a players IP and account creation time? -
Elysian` - 27.05.2012
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.
Re: How to get a players IP and account creation time? -
Audi_Quattrix - 27.05.2012
pawn Код:
format (string,sizeof(string)," Player %s joined the server [ Last Login: %s ; IP : %s]",GetPlayerName(bla bla),GetLastLogin ,GetPlayerIp(bla bla));
Re: How to get a players IP and account creation time? -
Elysian` - 27.05.2012
Urm, No.
"GetLastLogin"? Im not a retard, I know how to string it all together, It's the functions and that.
Re: How to get a players IP and account creation time? -
TzAkS. - 27.05.2012
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)
Re: How to get a players IP and account creation time? -
Audi_Quattrix - 27.05.2012
My string was just example I didnt meant Get last login is function....Sorry
Re: How to get a players IP and account creation time? -
iggy1 - 27.05.2012
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