Register date 0?
#1

Hello, i added register date in my server but i get a problem. It show me always 00/00/00 - 00:00:00, seems he cant detect date and time

This is the register part:

pawn Код:
new Year, Month, Day, Hour, Minute, Second;
            getdate(Year, Month, Day);
            gettime(Hour, Minute, Second);
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Data");
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"Admin",0);
            INI_WriteInt(file,"Cash",0);
            INI_WriteInt(file,"Vip",0);
            INI_WriteInt(file,"Scores",0);
            INI_WriteInt(file,"Deaths",0);
            INI_WriteInt(file,"Nopm",0);
            INI_WriteInt(file,"Muted",0);
            INI_WriteInt(file,"Vip",0);
            INI_WriteInt(file,"Banned",0);
            INI_WriteInt(file,"Cookies",0);
            INI_WriteInt(file,"Warn",0);
            INI_WriteInt(file,"Jailed", 0);
            INI_WriteInt(file,"Logged", 1);
            INI_WriteInt(file,"AdminActions", 0);
            INI_WriteInt(file, "Rank", 0);
            INI_WriteInt(file, "RegisterDate_day", Day);
            INI_WriteInt(file, "RegisterDate_mon", Month);
            INI_WriteInt(file, "RegisterDate_year",Year);
            INI_WriteInt(file, "RegisterDate_hour",Hour);
            INI_WriteInt(file, "RegisterDate_min", Minute);
            INI_WriteInt(file, "RegisterDate_sec", Second);
            INI_WriteInt(file,"Taxes",0);
            INI_Close(file);
And this is the code in /stats to show register date:

pawn Код:
format(temp, sizeof(temp), "{FFFFFF}Register Date: {FEFA07}%02d:%02d:%02d - %02d:%02d:%02d\n",pInfo[playerid][RegisterDate_day],pInfo[playerid][RegisterDate_mon],pInfo[playerid][RegisterDate_year],pInfo[playerid][RegisterDate_hour],pInfo[playerid][RegisterDate_min],pInfo[playerid][RegisterDate_sec]);
Any idea to how to fix this?
Reply
#2

im not sure about my answer but have you tried loading it when player login? as you are still using your enum to call it.

EDIT

Example
pawn Код:
INI_Int("RegisterDate_day", pInfo[playerid][RegisterDate_day]);
INI_Int("RegisterDate_mon", pInfo[playerid][RegisterDate_mon]);
INI_Int("RegisterDate_year", pInfo[playerid][RegisterDate_year]);
INI_Int("RegisterDate_hour", pInfo[playerid][RegisterDate_hour]);
INI_Int("RegisterDate_min", pInfo[playerid][RegisterDate_min]);
INI_Int("RegisterDate_sec", pInfo[playerid][RegisterDate_sec]);
or try to put that inside where you load player's data.
Reply
#3

Did already, everything is saved when the players disconnects or connects.
Reply
#4

Up.

4char.
Reply
#5

Buuuump.
Reply
#6

I don't know what the problem is, but I would store the registration date/time in UNIX timestamp format.
Reply
#7

Quote:
Originally Posted by YJIET
Посмотреть сообщение
I don't know what the problem is, but I would store the registration date/time in UNIX timestamp format.
Whats the difference?
Reply
#8

I would recommend doing something like this:
pawn Код:
new Year, Month, Day, Hour, Minute, Second;
            getdate(Year, Month, Day);
            gettime(Hour, Minute, Second);
            new hashpass[129];
            new currenttime[25];
            format(currenttime, sizeof(currenttime), "%02d:%02d:%02d - %02d/%02d/%d", Hour, Minute, Second, Day, Month, Year);
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Data");
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"Admin",0);
            INI_WriteInt(file,"Cash",0);
            INI_WriteInt(file,"Vip",0);
            INI_WriteInt(file,"Scores",0);
            INI_WriteInt(file,"Deaths",0);
            INI_WriteInt(file,"Nopm",0);
            INI_WriteInt(file,"Muted",0);
            INI_WriteInt(file,"Vip",0);
            INI_WriteInt(file,"Banned",0);
            INI_WriteInt(file,"Cookies",0);
            INI_WriteInt(file,"Warn",0);
            INI_WriteInt(file,"Jailed", 0);
            INI_WriteInt(file,"Logged", 1);
            INI_WriteInt(file,"AdminActions", 0);
            INI_WriteInt(file, "Rank", 0);
            INI_WriteString(file, "RegisterDate", currenttime);
            INI_WriteInt(file,"Taxes",0);
            INI_Close(file);
Reply
#9

Quote:
Originally Posted by Logitech90
Посмотреть сообщение
Whats the difference?
You would need just one variable to store the registration date and time (currently you have six).
Код:
INI_WriteInt(file, "RegisterDate", gettime());
Reply
#10

Quote:
Originally Posted by BenzoAMG
Посмотреть сообщение
I would recommend doing something like this:
//pawn code
And what if i have to read my register date in /stats? What variable i would use? If i add "currenttime" then i have to use "currenttime[playerid]" or what?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)