register date
#1

Hello, i have a problem.

In this /register command (which it works), i save the registration date (date and time) when the player register, but there is problem!

I have a /astats cmd (for admins) and if i look the register date of that player, it says me: Register date: 00/00/0000 - 00:00:00

Why it doesnt save it?

Command:

pawn Code:
CMD:register(playerid, params[])
{
        new filestring[128];
        new kname[24];
        GetPlayerName(playerid, kname, 24);
        format(filestring, sizeof(filestring), "/Users/%s.ini", kname);
        if(fexist(filestring)) return SCM(playerid, COLOR_ORANGE, "You are already registered, please /login.");
        new hashpass[129];
        WP_Hash(hashpass,sizeof(hashpass),hashpass);
        if(sscanf(params, "s[129]", hashpass)) return SendClientMessage(playerid, -1, "{F70505}Usage: {FFFFFF}/register [password]");
        new Year, Month, Day, Hour, Minute, Second;
        getdate(Year, Month, Day);
        gettime(Hour, Minute, Second);
        new INI:File = INI_Open(Path(playerid));
        INI_SetTag(File,"data");
        INI_WriteString(File,"Password",hashpass);
        INI_WriteInt(File,"Cash",0);
        INI_WriteInt(File,"Admin",0);
        INI_WriteInt(File,"Kills",0);
        INI_WriteInt(File,"Deaths",0);
        INI_WriteInt(File,"NoPm",0);
        INI_WriteInt(File,"Mute",0);
        INI_WriteInt(File,"Vip",0);
        INI_WriteInt(File,"C4",0);
        INI_WriteInt(File,"Banned",0);
        INI_WriteInt(File,"Cookies",0);
        INI_WriteInt(File,"Warn",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,"Jailed", 0);
        INI_WriteInt(File,"Logged", 1);
        INI_WriteInt(File,"AdminActions", 0);
        INI_WriteInt(File, "Rank", 0);
        INI_Close(File);
        PlayerInfo[playerid][pLogged] ++;
        TotalRegister++;
        SendClientMessage(playerid, COLOR_SYSTEM, "System: Registered and autologged! Next time you join be sure to /login!");
        GameTextForPlayer(playerid, "~r~Registered ~w~and ~r~autologged~w~! Next time you join be sure to ~g~/login!", 5000, 3);
        new echo[250];
        new echo2[140];
        new admin[140];
        new IP[16];
        GetPlayerIp(playerid, IP, 16);
        format(echo,sizeof(echo),"0,3System: %s (%d) (IP: %s) has registered a new account - %02d:%02d:%02d - %02d:%02d:%02d",kname,playerid,IP,Day,Month,Year,Hour,Minute,Second);
        format(echo2,sizeof(echo2),"0,3System: %s (%d) has registered a new account - Total Accounts: %d",kname,playerid,TotalRegister);
        format(admin,sizeof(admin),"System: %s (%d) (IP: %s) has registered a new account - Total Accounts: %d.",kname,playerid,IP,TotalRegister);
        IRC_GroupSay(gGroupID, IRC_ACHANNEL, echo);
        IRC_GroupSay(gGroupID, IRC_CHANNEL, echo2);
        SendMessageToAdmins(0x00FFFFFF,admin);
        return 1;
}
And this are the variables i read with /astats:

pawn Code:
Register Date: %02d/%02d/%02d - %02d:%02d:%02d\n",PlayerInfo[giveplayerid][RegisterDate_day],PlayerInfo[giveplayerid][RegisterDate_mon],PlayerInfo[giveplayerid][RegisterDate_year],PlayerInfo[giveplayerid][RegisterDate_hour],PlayerInfo[giveplayerid][RegisterDate_min],PlayerInfo[giveplayerid][RegisterDate_sec]);
pInfo enum:

pawn Code:
RegisterDate_day,
    RegisterDate_mon,
    RegisterDate_year,
    RegisterDate_hour,
    RegisterDate_min,
    RegisterDate_sec
Thanks very much.
Reply
#2

well cant you open up the saved location and see if they are saved ?
Reply
#3

Quote:
Originally Posted by park4bmx
View Post
well cant you open up the saved location and see if they are saved ?
I did already, the variable is written but it says "00/00/0000 - 00:00:00" like i said.
Reply
#4

Do you have a saving function what oyu use on disconnect or something, the fault can also be there.
And a loading function?
Reply
#5

do a "printf" see if the variables "Hour, Minute, Second" are actually set to anything
Reply
#6

0000
Reply
#7

Quote:
Originally Posted by Porsche911
View Post
For the love of god, stop coming to the forum for EVERY single thing you need help with.
For the love of god, THIS IS NOT YOUR BUSINESS IF I COME HERE TO ASK HELP! It's called "scripting HELP" for a reason! Don't like my post? Ignore it, nobody asks you to reply!

Quote:
Originally Posted by Roel
View Post
Do you have a saving function what oyu use on disconnect or something, the fault can also be there.
And a loading function?
Yes, i have many saving functions: OnGamemodeExit, OnPlayerDisconnect and a custom stock to save all players online data every 5 minutes. This is OnPlayerDisconnect:

pawn Code:
new INI:File = INI_Open(Path(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerCash(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",GetPlayerScore(playerid));
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"NoPm",PlayerInfo[playerid][pNopm]);
    INI_WriteInt(File,"Mute",PlayerInfo[playerid][pMuted]);
    INI_WriteInt(File,"Vip",PlayerInfo[playerid][pVip]);
    INI_WriteInt(File,"C4",PlayerInfo[playerid][pC4]);
    INI_WriteInt(File,"Banned",PlayerInfo[playerid][pBanned]);
    INI_WriteInt(File,"Cookies",PlayerInfo[playerid][pCookies]);
    INI_WriteInt(File,"Warn",PlayerInfo[playerid][pWarn]);
    INI_WriteInt(File, "RegisterDate_day", PlayerInfo[playerid][RegisterDate_day]);
    INI_WriteInt(File, "RegisterDate_mon", PlayerInfo[playerid][RegisterDate_mon]);
    INI_WriteInt(File, "RegisterDate_year", PlayerInfo[playerid][RegisterDate_year]);
    INI_WriteInt(File, "RegisterDate_hour", PlayerInfo[playerid][RegisterDate_hour]);
    INI_WriteInt(File, "RegisterDate_min", PlayerInfo[playerid][RegisterDate_min]);
    INI_WriteInt(File, "RegisterDate_sec", PlayerInfo[playerid][RegisterDate_sec]);
    INI_WriteInt(File,"Jailed",PlayerInfo[playerid][pJailed]);
    INI_WriteInt(File,"Logged",0);
    INI_WriteInt(File,"B_Time",PlayerInfo[playerid][B_Time]);
    INI_WriteInt(File,"B_Till",PlayerInfo[playerid][B_Till]);
    INI_WriteInt(File,"AdminActions",PlayerInfo[playerid][pAdminActions]);
    INI_WriteInt(File,"Rank",PlayerInfo[playerid][pRank]);
    INI_Close(File);
The custom stock is the same, with just added loop.
Reply
#8

00000
Reply
#9

Quote:
Originally Posted by park4bmx
View Post
do a "printf" see if the variables "Hour, Minute, Second" are actually set to anything
You done that ?
Reply
#10

Quote:
Originally Posted by park4bmx
View Post
You done that ?
Yes and it prints me the current date/time.

I rescripted the account system, now the register date/time is saved in the player file but if i do /astats i get always 00/00/0000 - 00:00:00.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)