Jump to content
  • 0

Problema login


Iulian

Question

Salut! Recent m-am apucat sa creez un gamemode de la 0, iar la sistemul de login am dat de o problema care imi da batai de cap.

Problema consta in: eu cand ma inregistrez imi pun parola "parola" (spre exemplu). Toate bune si frumoase, parola se salveaza in fisierul utilizatorului, dar cand vreau sa ma loghez, daca pun o alta parola, spre exemplu "sanandreas" ma conecteaza, chiar daca parolele nu corespund.

DIALOG LOGIN:

[pawn] if(dialogid == DIALOG_LOGIN)

{

if(!response)

{

    Kick(playerid);

}

else

{

    new name[64],file[128], pas[64];

    GetPlayerName(playerid, name, sizeof(name));

format(file, sizeof(file), "Utilizatori/%s.ini", name);

format(pas, sizeof(pas), "%s", dini_Int(file, "Parola"));

if(strcmp(inputtext, pas, false) == 0)

{

    LoadUser(playerid);

}

else

{

    SendClientMessage(playerid, COLOR_RED, "Parola incorecta!");

    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Logare", "Introdu parola mai jos pentru a te loga", "Logare", "Anulare");

}

}

return 1;

}[/pawn]

LoadUser:

[pawn]forward LoadUser(playerid);

public LoadUser(playerid)

{

    new name[64], file[64];

GetPlayerName(playerid, name, sizeof(name));

format(file, sizeof(file), "Utilizatori/%s.ini", name);

PlayerInfo[playerid][pLogged] = 1;

PlayerInfo[playerid][pAdmin] = dini_Int(file, "Admin");

PlayerInfo[playerid][pPassword] = dini_Int(file, "Parola");

return 1;

}[/pawn]

Rate me :)

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

Parola trebuie sa fie de tip string nu integer.

foloseste dini_Get( File , "Var" ) pentru a lua un string.

Gen:

[pawn]

if(dialogid == DIALOG_LOGIN)

{

if(!response)

{

    Kick(playerid);

}

else

{

    new name[64],file[128], pas[64];

    GetPlayerName(playerid, name, sizeof(name));

format(file, sizeof(file), "Utilizatori/%s.ini", name);

format(pas, sizeof(pas), "%s", dini_Get(file, "Parola"));

if(strcmp(inputtext, pas, false) == 0)

{

    LoadUser(playerid);

}

else

{

    SendClientMessage(playerid, COLOR_RED, "Parola incorecta!");

    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, "Logare", "Introdu parola mai jos pentru a te loga", "Logare", "Anulare");

}

}

return 1;

}

forward LoadUser(playerid);

public LoadUser(playerid)

{

    new name[64], file[64];

GetPlayerName(playerid, name, sizeof(name));

format(file, sizeof(file), "Utilizatori/%s.ini", name);

PlayerInfo[playerid][pLogged] = 1;

PlayerInfo[playerid][pAdmin] = dini_Int(file, "Admin");

        format( PlayerInfo[ playerid ] [ pPassword ] , 30 , "%s" , dini_Get( file , "Parola" ) );

return 1;

}

[/pawn]

P.S: in enum PlayerInfo pui pPassword[ 30 ].

Asa vei seta ca pPassword sa fie un string.

I'm back bitches.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. For more details you can also review our Terms of Use and Privacy Policy.