y_users and y_uvar help
#1

I thought I'd try something new and learn how to use these YSI libraries but I'm stuck. I'm trying to make a basic registration system right now... and simply don't understand how.

pawn Код:
public OnPlayerConnect(playerid)
{
    Langs_SetPlayerLanguage(playerid, lEnglish);
    if(Player_IsRegistered(playerid)) {
        ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter the password to this account below to continue.","Login","Change Name");
    }
    else {
        ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password to register this account below.","Register","Change Name");
    }
    return 1;
}
pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    switch(dialogid) {
        case DIALOG_LOGIN: {
            if(!response) ShowPlayerDialog(playerid,DIALOG_CHANGENAME,DIALOG_STYLE_INPUT,"Change name","Enter a new name below to continue (Firstname_Lastname format).","Change","Quit");
            else if(response) {
                if(strlen(inputtext)) {
                    new str[32]; format(str,sizeof(str),"%s",inputtext);
                    Player_TryLogin(playerid,str);
                }
                else {
                    SendClientMessage(playerid,-1,"Invalid field entry. Please try again.");
                    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_INPUT,"Login","Please enter the password to this account below to continue.","Login","Change Name");
                }
            }
        }
        case DIALOG_REGISTER: {
            if(!response) ShowPlayerDialog(playerid,DIALOG_CHANGENAME,DIALOG_STYLE_INPUT,"Change name","Enter a new name below to continue (Firstname_Lastname format).","Change","Quit");
            else if(response) {
                if(strlen(inputtext)) {
                    new str[32]; format(str,sizeof(str),"%s",inputtext);
                    Player_TryRegister(playerid,str);
                }
                else {
                    SendClientMessage(playerid,-1,"Invalid field entry. Please try again.");
                    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"Register","Please enter a password to register this account below.","Register","Change Name");
                }
            }
        }
    }
    return 1;
}
When a player first creates an account, their ID file is generated in YSI\users\ like it should but with contents similar to this (?):
Код:
[@@BasicRoleplay-y_uvar]
PlayerInfo = 27
@@PlayerInfo-0 = >>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
@@PlayerInfo-1 = >>>>>>>>>>>>>>>>
I don't really comprehend any of that. Or know if I even should. But anyway, afterwards they can login with any password. Obviously the problem is the password isn't being stored/is being stored and not checked for correctness, but the purpose of these libraries is to handle all that in the back end, no? So I don't know where to look to fix this.

I found this: https://sampforum.blast.hk/showthread.php?tid=414141 but there's no mention of registration/handling passwords that I can see so that just confused me even more.

And also, this message is displayed in the console for players joining:
Код:
format_DoDisplay b: 0, 000000, "Text Not Found"
What is that?

Sorry for the lengthy post and thanks in advance for any help. I know I'm probably just missing something important somewhere, I haven't been scripting lately.
Reply
#2

I'm not going to say not use YSI for a login/reg system or uvars but I'll give you some friendly feedback with my experience with using it. I was using it at one point and it works fairly well but eventually some issues came up such as difficulty modifying data associated with uvars directly and sometimes the system would bug out preventing users from logging in. Now back to your problem I'm going to suggest using the user system that comes with YSI and also advise against using OnDialogResponse() there is a far superior way in the YSI system that is y_inline/y_dialog read about it here https://sampforum.blast.hk/showthread.php?tid=295049.

Now with that aside I'm going to recommend doing your system completely in MySQL or SQLite.
Reply
#3

Quote:

I'm going to suggest using the user system that comes with YSI

Would that not be y_users, or what are you referencing here?

I'm looking into y_dialog, thanks for that. As for a MySQL system, I've already used one in another script and that's why I'm trying this way out - just to do something new and challenge myself (I'm really bored).
Reply
#4

Yes y_users
Reply
#5

I don't understand? That's what I'm already trying to use here

Edit: I've got everything sorted now.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)