SA-MP Forums Archive
Getting players time/date registered? [MySQL] - 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: Getting players time/date registered? [MySQL] (/showthread.php?tid=421414)



Getting players time/date registered? [MySQL] - FunnyBear - 09.03.2013

Hello, I was wondering how you would get the players registered time/date. I use MySQL! But I cannot figure a way out on how to get the players time registered? I hope you can help me!

Thanks


Re: Getting players time/date registered? [MySQL] - Djole1337 - 09.03.2013

You can use NOW()


Re: Getting players time/date registered? [MySQL] - FunnyBear - 09.03.2013

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
You can use NOW()
Whaat? Can you explain more, I don't get you?


Re: Getting players time/date registered? [MySQL] - Djole1337 - 09.03.2013

Код:
UPDATE `something` SET `something` = NOW()
That will insert current date/time


Re: Getting players time/date registered? [MySQL] - FunnyBear - 09.03.2013

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
Код:
UPDATE `something` SET `something` = NOW()
That will insert current date/time
No, that won't work! Can someone else explain?


Re: Getting players time/date registered? [MySQL] - Djole1337 - 09.03.2013

No, that works fine.

Can you post your code ?


Re: Getting players time/date registered? [MySQL] - FunnyBear - 09.03.2013

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
No, that works fine.

Can you post your code ?
Which part?


Re: Getting players time/date registered? [MySQL] - Djole1337 - 09.03.2013

Err, just show me the insert part.


Re: Getting players time/date registered? [MySQL] - FunnyBear - 09.03.2013

Quote:
Originally Posted by Mr_DjolE
Посмотреть сообщение
Err, just show me the insert part.
pawn Код:
stock MySQL_Register(playerid, passwordstring[])
{
    new query[200], pname[24], IP[16];
    GetPlayerName(playerid, pname, 24);
    GetPlayerIp(playerid, IP, 16);
    format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, score, money, IP) VALUES('%s', SHA1('%s'), 0, 0, 0, '%s')", pname, passwordstring, IP);
    mysql_query(query);
    SendClientMessage(playerid, INFO, ">> You have sucesfully registered a new account!");
    Logged[playerid] = 1;
    return 1;
}



Re: Getting players time/date registered? [MySQL] - Djole1337 - 09.03.2013

Ugh as I can see you don't have any "registered" field.

But anyways that should look like:
pawn Код:
format(query, sizeof(query), "INSERT INTO playerdata (user, password, Adminlevel, score, money, IP, register_date) VALUES('%s', SHA1('%s'), 0, 0, 0, '%s', NOW())", pname, passwordstring, IP);