[HELP] please help password
#1

Hello I register on my server with password mycar okey my password then is hashed in ini file but the problem is know when I go to login part and I enter password for example buuuu I spawn on server but it should says that is password is wrong. So this is the code for password login part

pawn Код:
if(!strcmp(hashpass,PlayerInfo[playerid][Password],false))
Reply
#2

Show your login and register Dialogs
Reply
#3

here

pawn Код:
case DIALOG_REGISTER:
        {
            if(!response) return Kick(playerid);
            if(response)
            {
                if(strlen(inputtext) < MIN_DUZINA_LOZINKE || strlen(inputtext) > MAX_DUZINA_LOZINKE)
                {
                    new name[MAX_PLAYER_NAME];
                    GetPlayerName(playerid,name,sizeof(name));
                    new regstring[512];
                    format(regstring,sizeof(regstring),"{F81414}[Greska!] {48E31C}Lozinka prekratka\n{FFFFFF}Lozinka ne smije biti manja od 6,a veca od 20 znakova!\n\n{FFFFFF}Dobrodošli na G-Unit!\n{48E31C}%s\n{FFFFFF}Vas korisnicki racun nije pronadjen, molimo upisite lozinku:",name);
                    ShowPlayerDialog(playerid,DIALOG_REGISTER,DIALOG_STYLE_INPUT,"{48E31C}G{FFFFFF}-Unit {48E31C}R{FFFFFF}ol{48E31C}e{FFFFFF}play Registracija",regstring,"Registriraj","Izlaz");
                    return 1;
                }
                new buf[129];
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                WP_Hash(buf,sizeof(buf),inputtext);
                INI_WriteString(File,"Lozinka",buf);
                INI_WriteInt(File,"Level",0);
                INI_WriteInt(File,"Novac",0);
                INI_WriteInt(File,"Spol",0);
                INI_WriteInt(File,"Porijeklo",0);
                INI_WriteInt(File,"Godine",0);
                INI_WriteInt(File,"Skin",0);
                INI_WriteInt(File,"Registriran",0);
                INI_WriteInt(File,"SpawnPromijena",1);
                INI_WriteInt(File,"Clan",0);
                INI_WriteInt(File,"Lider",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"GameSage",0);
                INI_WriteInt(File,"Kuca",-1);
                INI_WriteInt(File,"Stan",-1);
                INI_WriteInt(File,"Vikendica",-1);
                INI_WriteInt(File,"Hotel",-1);
                INI_WriteInt(File,"Firma",-1);
                INI_WriteInt(File,"SFirma",-1);
                INI_Close(File);
                SetPlayerInterior(playerid,0);
                SetPlayerVirtualWorld(playerid,0);
                TogglePlayerControllable(playerid,0);
                SetPlayerHealth(playerid,99.0);
                RegistrationStep[playerid] = 1;
                SetTimerEx("PostaviKameru1",1000,false,"d",playerid);
                ShowPlayerDialog(playerid,3,DIALOG_STYLE_LIST,"{00C0FF}Registracija-{48E31C}Koji ste spol?","{FFFFFF}Musko\n{FFFFFF}Zensko","U redu","Odustani");
                ClearChatbox(playerid,2);
            }
        }
        case DIALOG_LOGIN:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(strlen(inputtext) < MIN_DUZINA_LOZINKE)
                {
                    new LozinkaString[128];
                    format(LozinkaString,sizeof LozinkaString,"*G-Unit: Lozinka mora sadrzavati najmanje %d znakova!",MIN_DUZINA_LOZINKE);
                    SendClientMessage(playerid,0xDB023EFF,LozinkaString);
                    new name[MAX_PLAYER_NAME],loginstring[512];
                    GetPlayerName(playerid,name,sizeof(name));
                    format(loginstring,sizeof(loginstring),"{48E31C}_______________________________________\n\n{F81414}[Greska] {48E31C}Unesena lozinka prekratka!\n\n{FFFFFF}Dobrodošao na G-Unit!\n\n{48E31C}%s\n{FFFFFF}Vas je korisnicki racun pronadjen!\n\nMolimo upisi lozinku u polje ispod da udjes na server:\n{48E31C}_______________________________________",name);
                    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{48E31C}G{FFFFFF}-Unit {48E31C}R{FFFFFF}ol{48E31C}e{FFFFFF}play Login",loginstring,"Logiraj","Izlaz");
                    return 1;
                }
                else if(strlen(inputtext) > MAX_DUZINA_LOZINKE)
                {
                    new LozinkaString[128];
                    format(LozinkaString,sizeof LozinkaString,"*G-Unit: Lozinka mora sadrzavati najvise %d znakova!",MAX_DUZINA_LOZINKE);
                    SendClientMessage(playerid,0xDB023EFF,LozinkaString);
                    new name[MAX_PLAYER_NAME],loginstring[512];
                    GetPlayerName(playerid,name,sizeof(name));
                    format(loginstring,sizeof(loginstring),"{48E31C}_______________________________________\n\n{F81414}[Greska] {48E31C}Unesena lozinka preduga!\n\n{FFFFFF}Dobrodošao na G-Unit!\n\n{48E31C}%s\n{FFFFFF}Vas je korisnicki racun pronadjen!\n\nMolimo upisi lozinku u polje ispod da udjes na server:\n{48E31C}_______________________________________",name);
                    ShowPlayerDialog(playerid,DIALOG_LOGIN,DIALOG_STYLE_PASSWORD,"{48E31C}G{FFFFFF}-Unit {48E31C}R{FFFFFF}ol{48E31C}e{FFFFFF}play Login",loginstring,"Logiraj","Izlaz");
                    return 1;
                }
                new hashpass[129];
                WP_Hash(hashpass,sizeof(hashpass),inputtext);
                if(!strcmp(hashpass,PlayerInfo[playerid][Lozinka],false))
                {
                    INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true, .extra = playerid);
                    SetSpawnInfo(playerid,0,PlayerInfo[playerid][Skin],1765.2643,-1342.9196,15.7564,242.7716,0,0,0,0,0,0);
                    SpawnPlayer(playerid);
                    if(PlayerInfo[playerid][Registriran] == 1)
                    {
                        new godine,mjesec,dan,mtext[128],spawnime[MAX_PLAYER_NAME],spawnstring[256];
                        new randx = random(sizeof(IzrekaDana));
                        RPIme(playerid,spawnime);
                        getdate(godine,mjesec,dan);
                        if(mjesec == 1) { mtext = "Siječanj.2013"; }
                        else if(mjesec == 2) { mtext = "Veljača.2013"; }
                        else if(mjesec == 3) { mtext = "Ozujak.2013"; }
                        else if(mjesec == 4) { mtext = "Travanj.2013"; }
                        else if(mjesec == 5) { mtext = "Svibanj.2013"; }
                        else if(mjesec == 6) { mtext = "Lipanj.2013"; }
                        else if(mjesec == 7) { mtext = "Srpanj.2013"; }
                        else if(mjesec == 8) { mtext = "Kolovoz.2013"; }
                        else if(mjesec == 9) { mtext = "Rujan.2013"; }
                        else if(mjesec == 10) { mtext = "Listopad.2013"; }
                        else if(mjesec == 11) { mtext = "Studeni.2013"; }
                        else if(mjesec == 12) { mtext = "Prosinac.2013"; }
                        new sati,minuta,sekundi;
                        gettime(sati,minuta,sekundi);
                        FixHour(sati);
                        sati = shifthour;
                        SCMF(playerid,SVIJETLOPLAVA,"*Dobrodosao %s nazad na G-Unit Roleplay server.",spawnime);
                        //SendClientMessageF(playerid,COLOR_BIJELA,"*Tvoj dosadasnji zivot: Level [%d] | Respekti [%d/%d] | Sati igranja [%d]",PlayerInfo[playerid][Level],PlayerInfo[playerid][Respekti],expamount,satiigranja);
                        SCMF(playerid,MojaBoja,"*Izreka Dana: %s",IzrekaDana[randx]);
                        SCMF(playerid,COLOR_ZUTA,"*Datum: %s%d.%s | Vrijeme: %s%d:%s%d",(dan < 10)?("0") :(""),dan,mtext,(sati < 10)?("0") :(""),sati,(minuta < 10)?("0") :(""),minuta);
                        format(spawnstring,sizeof(spawnstring),"~n~~n~~n~~n~~r~DOBRODOSAO~n~~w~%s",spawnime);
                        GameTextForPlayer(playerid,spawnstring,4000,5);
                    }
                }
                else
                {
                    new hIme[MAX_PLAYER_NAME];
                    RPIme(playerid,hIme);
                    new loginstring[512];
                    format(loginstring,sizeof(loginstring),"{48E31C}_____________________________________\n\n{F81414}[Greska] {48E31C}Unijeli ste netocnu lozinku!\n\n{FFFFFF}Vas korisnicki je pronadjen!\n{48E31C}%s\n\n{FFFFFF}Molimo upisite vasu lozinku:\n{48E31C}_____________________________________",hIme);
                    ShowPlayerDialog(playerid,1,DIALOG_STYLE_PASSWORD,"{48E31C}G{FFFFFF}-Unit {48E31C}R{FFFFFF}ol{48E31C}e{FFFFFF}play Login",loginstring,"Logiraj","Izlaz");
                    PokusajiLogiranja[playerid]++;
                    if(PokusajiLogiranja[playerid] >= MAX_POKUSAJA_LOGIRANJA)
                    {
                        SendClientMessage(playerid,0xDB023EFF,"{48E31C}G-Protect: {FFFFFF}Vas korisnicki racun je iskljucen sa servera! Unijeli ste 3 puta netocnu lozinku!");
                        SendClientMessage(playerid,COLOR_BIJELA,"G-Protect: Vasa IP adresa je banana! Zatrazite unban na nasem forumu!");
                        KickWithMessage(playerid);
                    }
                }
                return 1;
            }
        }
    }
Reply
#4

You probabily haven't loaded or stored the password in the array PlayerInfo[playerid][Lozinka].

So for that either simply open the file and store data or parse it on connect and load all data!

pawn Код:
public OnPlayerConnect(playerid)
{
       if(fexist(UserPath(playerid)))
       {
          INI_ParseFile(UserPath(playerid),"LoadUser_%s",.bExtra = true, .extra = playerid);
       }
       return 1;
}
https://sampwiki.blast.hk/wiki/Strcmp
The function return zero if string is empty!
Reply
#5

I already have that
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)