Y_INI - Last logged in?
#1

How would I go about doing something like that? Creating a string variable that saves the date like: 01/02/1970? I'm new to Y_INI, so I don't know how I would go about doing this.
Reply
#2

Actually use getdate and gettime under onPLayerDisconnect and then just save it
Reply
#3

Quote:
Originally Posted by [MG]Dimi
Посмотреть сообщение
Actually use getdate and gettime under onPLayerDisconnect and then just save it
My enum variable would be a string, correct?
Reply
#4

How would I go about displaying it? I have the variables saving and loading correctly, I just don't know how to display it on a string, as it's not working correctly.

It saves in the file as-
Quote:

LastLoggedIn = 12/2/2011

Which is correct, and works correctly.

Displaying it- (It displays as a square..)
pawn Код:
format(string, sizeof(string), "You last logged in on: %s!\nYou currently have %d points to spend!", UserInfo[playerid][LastLoggedIn], UserInfo[playerid][Points]);
                    ShowPlayerDialog(playerid, DIALOG_SUCCESS_2, DIALOG_STYLE_MSGBOX, ""COL_WHITE"You have been logged in!", string, "Play", "");
Writing it-
pawn Код:
new year, month, day;
                getdate(year, month, day);
new string[128];
                format(string, sizeof(string), "%d/%d/%d", month, day, year);
                INI_WriteString(File, "LastLoggedIn", string);
Reply
#5

pawn Код:
new
        LastON[40],
        Year,
        Month,
        Day,
        Hour,
        Minute,
        Second;

                getdate(Year,Month,Day);
        gettime(Hour,Minute,Second);
        format(LastON, sizeof LastON, "%d/%d/%d at %d:%d:%d", Day,Month,Year,Hour,Minute,Second);
That should do it.
Reply
#6

Quote:
Originally Posted by antonio112
Посмотреть сообщение
pawn Код:
new
        LastON[40],
        Year,
        Month,
        Day,
        Hour,
        Minute,
        Second;

                getdate(Year,Month,Day);
        gettime(Hour,Minute,Second);
        format(LastON, sizeof LastON, "%d/%d/%d at %d:%d:%d", Day,Month,Year,Hour,Minute,Second);
That should do it.
I don't think you understood correctly. I need it to read the following text correctly: "12/3/2011" from a file, but for some reason a string is not doing it correctly.
Reply
#7

use this:

pawn Код:
INI_String("LastLoggedIn", UserInfo[playerid][LastLoggedIn], 64);
format(string, sizeof string, "Last logged in: %s", UserInfo[playerid][LastLoggedIn]);
SendClientMessage(playerid, ~1, string);
Reply
#8

Quote:
Originally Posted by Scarred
Посмотреть сообщение
I don't think you understood correctly. I need it to read the following text correctly: "12/3/2011" from a file, but for some reason a string is not doing it correctly.
Ohh, yea... Sorry, I totally misread you.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)