Question
#1

So my question is how do i make that when player registers it says:

"Your registered account: <MYNAME>, Password: <MYPASSWORD>, Last Online: Date/Date/Date"

If you can give me the code. Because i tried but can't. And when everytime join the server but already registered to say only

"Last Online: Date/Date/Date"

Thanks anyway.

Also my Register/Login system YSI/Y_ini.

Main Question: How to make this thing?
Reply
#2

Quote:
Originally Posted by Lixyde
Посмотреть сообщение
Because i tried but can't.
What did you try ?
Reply
#3

Make use of these following functions:

format
SendClientMessage
getdate
GetPlayerName

In the login function, fetch the last online date and format the message and send it. Save the date.
In the register function, fetch the date, the account name and password. Do the same as the login one, format it and send it. Save the date.

That's it.
Reply
#4

Код:
switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFC800}Toxic{00FF00}Freeroam","{FF4600}Написахте невалидна парола!.\n{00C3FF}Напишете паролата с която искате да се регистрирате.","Регистрация","Отказ");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                SpawnPlayer(playerid);
                new pName[MAX_PLAYER_NAME];
				new string[128];
				GetPlayerName(playerid, pName, sizeof(pName));
				format(string, sizeof(string), "You register account with the name: %s, password: %s", pName);
			}
        }
I dont know the thing to show your password also i use udb_hash, i don't know how is gonna work, when if you type password when you register and it is: 123 and on the config of the player the pass says: 125109138944,

I learned that is for the password cannot be hacked but how to remove it, or do i need to use it, but how to say what password did the player register?? and for the date i don't know how to do it.
Reply
#5

Well, you use the function "udb_hash" which is quite inefficient and is a hashing technique. Any thing hashed looses it's true meaning. If you remove it, it'll save password in plain text but it's against SA-MP rules.

Use getdate function to get the date (lmao)
Reply
#6

Quote:
Originally Posted by Logic_
Посмотреть сообщение
Make use of these following functions:

format
SendClientMessage
getdate
GetPlayerName

In the login function, fetch the last online date and format the message and send it. Save the date.
In the register function, fetch the date, the account name and password. Do the same as the login one, format it and send it. Save the date.

That's it.
as logic_ said
Код:
new name[25], string[100], day, month, year;
GetPlayerName(playerid, name, sizeof(name));
getdate(year, month, day);
format(string, 100,"Your registered account: <Name:%s><Password:%s>[Day:%d, Month:%d, Year:%d]", name,inputtext, day, month, year);
SendClientMessage(playerid, COLOR_YOUWANT, string);
On Your Dialog
PHP код:
switch(dialogid)
    {
        case 
DIALOG_REGISTER:
        {
            if (!
response) return Kick(playerid);
            if(
response)
            {
                if(!
strlen(inputtext)) return ShowPlayerDialog(playeridDIALOG_REGISTERDIALOG_STYLE_INPUT"{FFC800}Toxic{00FF00}Freeroam","{FF4600}Написахте невалидна парола!.\n{00C3FF}Напишете паролата с която искате да се регистрирате.","Регистрация","Отказ");
                new 
INI:File INI_Open(UserPath(playerid));
                
INI_SetTag(File,"data");
                
INI_WriteInt(File,"Password",udb_hash(inputtext));
                
INI_WriteInt(File,"Cash",0);
                
INI_WriteInt(File,"Admin",0);
                
INI_WriteInt(File,"Kills",0);
                
INI_WriteInt(File,"Deaths",0);
                
INI_Close(File);
                
SpawnPlayer(playerid);
                new 
name[25], string[100], daymonthyear;
                
GetPlayerName(playeridnamesizeof(name));
                
getdate(yearmonthday);
                
format(string100,"Your registered account: <Name:%s><Password:%s>[Day:%d, Month:%d, Year:%d]"name,inputtextdaymonthyear);
                
SendClientMessage(playeridCOLOR_YOUWANTstring);
            }
        } 
you can make it like this hope its useful, enjoy.
Reply
#7

Use ******, with the question in the end write samp, have multiples tutorials.
Reply
#8

Код:
switch(dialogid)
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, "{FFC800}Toxic{00FF00}Freeroam","{FF4600}Написахте невалидна парола!.\n{00C3FF}Напишете паролата с която искате да се регистрирате.","Регистрация","Отказ");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_Close(File);
                SpawnPlayer(playerid);
                new pName[MAX_PLAYER_NAME];
				new string[128];
				GetPlayerName(playerid, pName, sizeof(pName));
				format(string, sizeof(string), "You register account with the name: %s, password: %s", pName, inputtext);
			}
        }
In this case your inputtext is the password you typed in while registering.

As for the date, you can get the date as following:

Код:
new Day, Month, Year, Hour, Minute, Second;
getdate(Year, Month, Day);
gettime(Hour, Minute, Second);
And then print it.
As for last login time, you save it in player data upon connecting in OnPlayerConnect callback, then you save it in the file and format it later on, e.g. that's how I do welcoming message myself (note that there's little problem with formatting I was too lazy to fix, you might want to consider that some of the numbers there must be two digits, see to SAMP wiki to consult in regards to the issue)

Код:
format(str, sizeof(str), "Welcome back, %s. Your last login was on %d/%d/%d at %d:%d:%d.", GetPName(playerid), PlayerInfo[playerid][pLLYear], PlayerInfo[playerid][pLLMonth], PlayerInfo[playerid][pLLDay], PlayerInfo[playerid][pLLHour], PlayerInfo[playerid][pLLMin], PlayerInfo[playerid][pLLSec]);
Where LL stands for Last Login here. (GetPName is a custom function, let's say you have a formatted string with a name in it there).
Reply
#9

BulletRaja Your thing might work but how do i make when the player log again it says your last time in the server? I need to safe the date and the time? If i need tell me how?

Also if i need to remove udb_hash there will be errors where it says udb_hash there what i need to type?

EXAMPLE: if(udb_hash == pPass)) (ONLY EXAMPLE)

there will be error on udb_hash what i need to replace on udb_hash?
Reply
#10

Quote:
Originally Posted by Lixyde
Посмотреть сообщение
BulletRaja Your thing might work but how do i make when the player log again it says your last time in the server? I need to safe the date and the time? If i need tell me how?
That's quite simple. You use OnPlayerDisconnect callback for that:

Код:
new Hour, Minute, Second, Year, Month, Day;
gettime(Hour, Minute, Second);
getdate(Year, Month, Day);
//The following, I did with Y_Ini. It might differ if you don't use Y_Ini.
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"SomeTagHere");
INI_WriteInt(File,"Sec",Second);
INI_WriteInt(File,"Min",Minute);
INI_WriteInt(File,"Hour",Hour);
INI_WriteInt(File,"Day",Day);
INI_WriteInt(File,"Month",Month);
INI_WriteInt(File,"Year",Year);
...
Then, after the player connects, you read the player data from the file, and format the string in one of the fashions shown above.

As for udb_hash. Every time you type your password you sure will need this check done, but a bit differently:

Код:
if(udb_hash(inputtext) == pPass) //You need to do udb_hash for inputtext since your pPass is a result of your password going through udb_hash as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)