Jump to content
  • 0

pomoc přihlašování


bboyadams

Dotaz

Zdravím, chci se zeptat - Když se zaregistruju, opustím server a znovu připojím a přihlásím - všechno jde jak má.

Když však změním něco v databázy - například peníze a uložím (když jsem odpojen) - poté se znovu chci přihlásit, ale píše mi to, že nesprávné heslo. Kodil jsem to sám, proto to taky tak vypadá :d 

 

kod - 

 

 

 

else if(dialogid == Dialog_Login)
{
if(response == 1)
{
if(!inputtext[0]) return ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_PASSWORD,"Registrace","{E10000}! Nezadal jsi heslo !\n\n{ffffff}Zadej své heslo:","Potvrdit","Cancel");
else
{
new heslo[25];
strmid(heslo, inputtext[0], 0, strlen(inputtext[0]), 32);
OnPlayerLogin(playerid, heslo);
}
}
if(response == 2)
{
Kick(playerid);
}
}

 

ZDE JE PUBLIC NA PŘIHLÁŠENÍ

 

public OnPlayerLogin(playerid,password[])
{
    if(IsPlayerConnected(playerid))
{
     new string[40];
format(string, sizeof(string), "Mod/Users/%s.cfg", Jmeno(playerid));
 
new File:LogFile = fopen(string, io_read); //OPEN FILE
if(LogFile)
{
    new PassData[256],keytmp[256],valtmp[256];
   fread(LogFile,PassData,sizeof(PassData));
 
    keytmp = file_GetKey( PassData );
    if(strcmp(keytmp,"Heslo",true) == 0)
{
valtmp = file_GetValue(PassData);
strmid(Informace[playerid][Heslo],valtmp,0,strlen(valtmp)-1, 32);
}
 
if(strcmp(Informace[playerid][Heslo],password,true) == 0)
{
   new key[256],val[256],Data[256];
   while(fread(LogFile,Data,sizeof(Data)))
{
key = file_GetKey(Data);
 
//---------------------------------------------------------|
if(strcmp(key,"Zdravi",true) == 0)
{
val = file_GetValue(Data);
Informace[playerid][Zdravi] = floatstr(val);
if(Informace[playerid][Zdravi] < 1 || Informace[playerid][Zdravi] > 100) Informace[playerid][Zdravi] = 100;
}
                    //---------------------------------------------------------|
else if(strcmp(key,"Vesta",true) == 0)
{
val = file_GetValue(Data);
Informace[playerid][Vesta] = floatstr(val);
if(Informace[playerid][Vesta] < 0 || Informace[playerid][Vesta] > 100) Informace[playerid][Vesta] = 100;
}
                    //---------------------------------------------------------|
 
                    //---------------------------------------------------------|
else if(strcmp(key,"Banka",true) == 0)
{
val = file_GetValue(Data);
Informace[playerid][Banka] = strval(val);
}
//---------------------------------------------------------|
else if(strcmp(key,"Moto",true) == 0)
{
val = file_GetValue(Data);
Informace[playerid][Moto] = strval(val);
}
                    //---------------------------------------------------------|
else if(strcmp(key,"Ridicak",true) == 0)
{
val = file_GetValue(Data);
Informace[playerid][Ridicak] = strval(val);
}
                    //---------------------------------------------------------|
else if(strcmp(key,"Pilot",true) == 0)
{
val = file_GetValue(Data);
Informace[playerid][PilotniPrukaz] = strval(val);
}
                    //---------------------------------------------------------|
                    else if(strcmp(key,"Penize",true) == 0){val = file_GetValue(Data);Informace[playerid][Penize] = strval(val);}
else if(strcmp(key,"PolicejniZK",true) == 0){val = file_GetValue(Data);Informace[playerid][PolicejniZK] = strval(val);}
else if(strcmp(key,"VojenskeZK",true)  == 0){val = file_GetValue(Data);Informace[playerid][VojenskeZK]  = strval(val);}
else if(strcmp(key,"MafianskeZK",true) == 0){val = file_GetValue(Data);Informace[playerid][MafianskeZK] = strval(val);}
else if(strcmp(key,"Zbran1",true) == 0){val = file_GetValue(Data);Informace[playerid][Zbran1] = strval(val);}
else if(strcmp(key,"Zbran2",true) == 0){val = file_GetValue(Data);Informace[playerid][Zbran2] = strval(val);}
else if(strcmp(key,"Zbran3",true) == 0){val = file_GetValue(Data);Informace[playerid][Zbran3] = strval(val);}
else if(strcmp(key,"Zbran4",true) == 0){val = file_GetValue(Data);Informace[playerid][Zbran4] = strval(val);}
else if(strcmp(key,"Zbran5",true) == 0){val = file_GetValue(Data);Informace[playerid][Zbran5] = strval(val);}
else if(strcmp(key,"SkinID",true) == 0){val = file_GetValue(Data);Informace[playerid][Skin]   = strval(val);}
else if(strcmp(key,"WantedLVL",true)   == 0){val = file_GetValue(Data);Informace[playerid][WantedLevel] = strval(val);}
else if(strcmp(key,"SouradniceX",true) == 0){val = file_GetValue(Data);Informace[playerid][SouradniceX] = floatstr(val);}
else if(strcmp(key,"SouradniceY",true) == 0){val = file_GetValue(Data);Informace[playerid][SouradniceY] = floatstr(val);}
else if(strcmp(key,"SouradniceZ",true) == 0){val = file_GetValue(Data);Informace[playerid][SouradniceZ] = floatstr(val);}
else if(strcmp(key,"Interier",true)    == 0){val = file_GetValue(Data);Informace[playerid][Interier]    = strval(val);}
else if(strcmp(key,"Virtual World",true)    == 0){val = file_GetValue(Data);Informace[playerid][VirtualWorld]    = strval(val);}
                    else if(strcmp(key,"Povolani",true)    == 0){val = file_GetValue(Data);Zamestnani[playerid]     = strval(val);}
else if(strcmp(key,"Vezeni",true)      == 0){val = file_GetValue(Data);Informace[playerid][Vezeni]      = strval(val);}
else if(strcmp(key,"Admin Vezeni",true)      == 0){val = file_GetValue(Data);Informace[playerid][AVezeni]      = strval(val);}
                    else if(strcmp(key,"Hodin",true)         == 0){val = file_GetValue(Data);Informace[playerid][Hours]         = strval(val);}
                    else if(strcmp(key,"Minut",true)         == 0){val = file_GetValue(Data);Informace[playerid][Minutes]         = strval(val);}
                    else if(strcmp(key,"AdminLevel",true)  == 0){val = file_GetValue(Data);Informace[playerid][AdminLevel]  = strval(val);}
                    else if(strcmp(key,"Mute",true)  == 0){val = file_GetValue(Data);Informace[playerid][Umlceni]  = strval(val);}
                    else if(strcmp(key,"FightingS",true)  == 0){val = file_GetValue(Data);Informace[playerid][FightingStyle]  = strval(val);}
                    else if(strcmp(key,"Kredit",true)  == 0){val = file_GetValue(Data);Informace[playerid][Kredit]  = strval(val);}
                    else if(strcmp(key,"Hlad",true)  == 0){val = file_GetValue(Data);Informace[playerid][Hlad]  = strval(val);}
                    else if(strcmp(key,"House",true)  == 0){val = file_GetValue(Data);Informace[playerid][HouseP]  = strval(val);}
//---------------------------------------------------------|
     }
SpawnPlayer(playerid);
}
else
{
ShowPlayerDialog(playerid,Dialog_Login,DIALOG_STYLE_PASSWORD,"Přihlášení","{E10000}Heslo není správné !\n{ffffff}Zkus to znovu:","Potvrdit","");
return 0;
}
 
//-------------|
fclose(LogFile);
//-------------|
}
}
return 1;
}

 

Pomožte prosím, netuším vůbec proč nepřečte heslo po přepsání v souboru Users/%s.cfg - svůj nick .. heslo je tam furt stejný ale ve hře to píše poté že Heslo není správné. Díky všem!!!!!

Link to comment
Share on other sites

4 odpovědí na tuto otázku

Recommended Posts

  • 0

jo hele tohle si pamatuju z maikeroo town. file si musis otevrit v poznamkovym bloku a upravit tam. je tam nejakej problem se znakem kterej znaci ze ma bejt text na dalsim radku. ale tim ze to upravis se to spatne ulozi a prestane to fungovat. ten poznamkovej blok ti to otevre a data budes mit na jednom radku oddelenej takovym divnym obdelnikem.

Link to comment
Share on other sites

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
×
×
  • Create New...