Jump to content
Autentificarea cu Google și Facebook nu mai este disponibilă. ×
  • 0

Intrerupere-a variabilelor sau a inputtextului !


Question

Posted

Hello ! Am o problema cred ca destul de serioasa, am facut un gamemode de la 0 pe baza unei baze de date sqllite pentru o functionaliate mult mai rapida, iar ca sursa de date pentru utilizatori folosesc variabilele pentru jucatori [ PVars ] : link spre wiki.
La inceput citesc parola din baza de date si o salvez ca si o variabila simpla :

 

new handle = SL::OpenEx(SL::READ, "accounts", "username", GetPlayerUsername(playerid));
SL::ReadString(handle, "password", password, 64); SetPVarString(playerid,"password",password); // <-- aici salvez
SL::ReadInt(handle, "id", id); SetPVarInt(playerid, "id", id);
SL::Close(handle);

SetPVarString(playerid,"password",password);

Problema :

Cand apare dialogul de logare si cand ma duc la ondialogresponse si doresc sa verific parolele pentru autentificare se golesc tabelurile.

Adica ori se goleste inputtext[] ori tabelul in care am salvat parola de la variabila
 

if(dialogid == DIALOG_LOGIN_PASSWORD)
    {
        if(response && GetPVarInt(playerid, "loginattemps") >= 1)
        {
            new password[12];
          	GetPVarString(playerid, "password", password, sizeof(password)); // <-- aici salvez in tabel parola, inainte ii facem hash dar nu mergea sa verific parolele.....
          	
          	if(!strcmp(inputtext, password)){ // <- aici e verificarea
          	    loadplayerdata(playerid);
          	    SendClientMessage(playerid, COLOR_BUTTONS, "succes");
          	    ShowLoginPassword(playerid);
          	} else {
          	    new errorstr[75]; format(errorstr, sizeof(errorstr), "Your password is incorrect! You still have %d attempts.",GetPVarInt(playerid, "loginattemps"));
          	    SendClientMessage(playerid, COLOR_WARN, errorstr);
          	    SetPVarInt(playerid, "loginattemps", GetPVarInt(playerid, "loginattemps")-1);
          	    ShowLoginPassword(playerid);
          	}
        }
        else kick(playerid, COLOR_MAIN, "You lost the connection to the server! To exit type /q(uit).");
    }

Deci am testat si prin SendClientMessage, sa afisez ambele parole si se disbate un tabel si se face gol, si cand se compara parolele e mereu adevarat ca se compara un tabel gol cu unu plin cu parola hashurata [ adica i-am facut hash ( din parola simpla se face ceva de genu 3jeriyoj346oiwet98uv34958... ) pentru cine nu stia ]..
Va rog o sugestie cum as putea sa rezolv. Si mentionez ca nu doresc sa scriu pe tabel datele jucatorului adica pInfo[playerid][pPassword]... , am decis ca salvez datele jucatorului in PVar.. Va rog!
       

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • 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.