Problem On Login System
#1

Hello, So When It Shows The Dialog Register While Connecting To Server (Dialog ID 1) I Register Successfully,But When I Rejoin,And When I Type My Password,It Doesn't Work,And It Says Wrong Password,Codes:

pawn Код:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{
    #pragma unused ret_memcpy
    if(dialogid == 1) {
        new file[128], name[MAX_PLAYER_NAME], str[128] , ip[12];
        GetPlayerIp(playerid, ip, sizeof(ip));
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(file, sizeof(file), "Counter Strike/Users/%s.ini", name);
        if(response) {
            if(strlen(inputtext)) {
                dini_Create(file);
                dini_IntSet(file, "Password", num_hash(inputtext));
                dini_Set(file, "IP", ip);
                format(str, sizeof(str), "You are registered as ~r~%s. Your password is ~r~%s. /changepass to change it", name, inputtext);
                SendClientMessage(playerid, COLOR_YELLOW, str);
            }
        }
        else {
            Kick(playerid);
        }
    }
    if(dialogid == 2)
    {
        new file[128], name[MAX_PLAYER_NAME], str[128], ip[12];
        GetPlayerIp(playerid, ip, sizeof(ip));
        GetPlayerName(playerid, name, MAX_PLAYER_NAME);
        format(str, sizeof(str), "Counter Strike/Users/%s.ini", name);
        if(response) {
            if(strlen(inputtext)) {
                if(num_hash(inputtext) != dini_Int(file, "Password")) {
                    SendClientMessage(playerid, COLOR_RED, "Wrong Password");
                    ShowPlayerDialog(playerid, 2, DIALOG_STYLE_INPUT, "Please Login", "Enter Your Password Below", "Login", "Cancel");
                }
                else {
                    SendClientMessage(playerid, COLOR_YELLOW, "Succesfuly logged in");
                    PlayerInfo[playerid][AdminLevel] = dini_Int(file, "AdminLevel");
                    PlayerInfo[playerid][VIPLevel] = dini_Int(file, "VIPLevel");
                    GivePlayerMoney(playerid, dini_Int(file, "Cash"));
                    SetPlayerScore(playerid, dini_Int(file, "Score"));
                    PlayerInfo[playerid][Kills] = dini_Int(file, "Kills");
                    PlayerInfo[playerid][Death] = dini_Int(file, "Death");
                    dini_Set(file, "IP", ip);
                }
            }
        }
        else {
            Kick(playerid);
        }
    }
    return 1;
}
Reply
#2

anyone?
Reply
#3

OnDialogResponse callback should return 0, not 1.
Reply
#4

Still,when i write the correct password to login,it doesn't make me logged to my account.
Reply
#5

format(str, sizeof(str), "Counter Strike/Users/%s.ini", name);

You are formatting str not file.
Reply
#6

I think you can not make such roads to folders with empty space
PHP код:
format(filesizeof(file), "Counter Strike/Users/%s.ini"name); 
Edit: Late
Reply
#7

still,when i type my password,it still sends me: Wrong Password.
Reply
#8

I'd suggest you check your "users" file as the above didn't work for you!

I'd also suggest using mysql instead of Y_INI.
Reply
#9

i use Dini not Y_INI.

and the user information:

Password=295B0652D4FD7DC01D14EB47C0A1EA212188AE7A9 B19A5215149ABBED5CA17FDF167FD35DFA4BCD1CE5B0E7F1DA 67C2CB684D970A7174303C17C7B9A02BEAE42
IP=127.0.0.1
Logged=0
AdminLevel=0
VIPLevel=0
Cash=0
Score=0
Kills=0
Death=0
Reply
#10

anyone? i will +REP if someone helps me
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)