Djson help
#1

Hey guys,
Im working on my admin FS, and i got a problem with the password (again..). Everything saves good when you registered your account. When you disconnect, it saves all the things aswell. But now, when i try to login (when i already registered my account) i can login with any password. Ive checked my scriptfiles folder, for my file. I saw that the line where my password should be, is gone
Anyone can take a look at those pieces and tell me whats wrong
NOTE: I know there is no file[128], name[24], format(file) etc, but thats in my OnDialogResponse callback
pawn Код:
//Player disconnect:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[128];
    GetPlayerName(playerid, name, sizeof name); format(file, sizeof file, PlayerFile, name);
    djSetInt(file, "Loads/Money", GetPlayerMoney(playerid));
    djSetInt(file, "Loads/Score", GetPlayerScore(playerid));
    djSetInt(file, "Misc/Logged", 0);
    djCommit(file);
    return 1;
}
//Register dialog
if(dialogid == REGISTER)
{
    if(response)
    {
        new buffer[129];
        WP_Hash(buffer, sizeof buffer, inputtext);
        GetPlayerIp(playerid, pIp, sizeof pIp);
        djCreateFile(file);
        djSet(file, "Important/Name", name);
        djSet(file, "Important/Password", buffer);
        djSet(file, "Important/Ip", pIp);
        djSetInt(file, "Loads/Money", 500);
        djSetInt(file, "Loads/Score", 0);
        djSetInt(file, "Level/Admin level", 0);
        djSetInt(file, "Level/Vip level", 0);
        djSetInt(file, "Misc/Registered", 1);
        djSetInt(file, "Misc/Logged", 1);
        GivePlayerMoney(playerid, 500);
        djCommit(file);
        return 1;
       
    }
}
// Login dialog
if(dialogid == LOGIN)
{
    if(response)
    {
        new buffer[129];
        WP_Hash(buffer, sizeof buffer, inputtext);
        if(!strcmp(buffer, dj(file, "Important/Password"), false, 16))
        {
            new String[128], AdminStatus[128], VipStatus[128];
            GivePlayerMoney(playerid, djInt(file, "Loads/Money"));
            SetPlayerScore(playerid, djInt(file, "Loads/Score"));
            djSetInt(file, "Misc/Logged", 1);
            djCommit(file);
            return 1;
        }
       
    }
}
Reply
#2

Anyone knows?
Reply
#3

Example file when first log in (Didnt relog)
Код:
{
  "Important":{
    "Ip":"5.84.49.83",
    "Name":"king3killer",
    "Password":"D0B2F1DF0DDD73AB3F1714A40197A80BD7BFDECD1ACBD863D6185A623566B94983DBE2D9E73216D9C1D46D647A4420514E62C9DAED39A53188C81E4006B2708A"
  },
  "Level":{
    "Admin level":0,
    "Vip level":0
  },
  "Loads":{
    "Money":1951,
    "Score":0
  },
  "Misc":{
    "Logged":0,
    "Registered":1
  }
}
My file after i re-logged:
Код:
{
  "Important":{
    "Ip":"5.154.19.133",
    "Name":"LemmyLusion[NL]"
  },
  "Level":{
    "Admin level":0,
    "Vip level":0
  },
  "Loads":{
    "Money":300,
    "Score":0
  },
  "Misc":{
    "Logged":1,
    "Registered":1
  }
}
Reply
#4

Anyone?
Reply
#5

Quote:
Originally Posted by Wesley221
Посмотреть сообщение
Hey guys,
Im working on my admin FS, and i got a problem with the password (again..). Everything saves good when you registered your account. When you disconnect, it saves all the things aswell. But now, when i try to login (when i already registered my account) i can login with any password. Ive checked my scriptfiles folder, for my file. I saw that the line where my password should be, is gone
Anyone can take a look at those pieces and tell me whats wrong
NOTE: I know there is no file[128], name[24], format(file) etc, but thats in my OnDialogResponse callback
pawn Код:
//Player disconnect:
public OnPlayerDisconnect(playerid, reason)
{
    new name[MAX_PLAYER_NAME], file[128];
    GetPlayerName(playerid, name, sizeof name); format(file, sizeof file, PlayerFile, name);
    djSetInt(file, "Loads/Money", GetPlayerMoney(playerid));
    djSetInt(file, "Loads/Score", GetPlayerScore(playerid));
    djSetInt(file, "Misc/Logged", 0);
    djCommit(file);
    return 1;
}
//Register dialog
if(dialogid == REGISTER)
{
    if(response)
    {
        new buffer[129];
        WP_Hash(buffer, sizeof buffer, inputtext);
        GetPlayerIp(playerid, pIp, sizeof pIp);
        djCreateFile(file);
        djSet(file, "Important/Name", name);
        djSet(file, "Important/Password", buffer);
        djSet(file, "Important/Ip", pIp);
        djSetInt(file, "Loads/Money", 500);
        djSetInt(file, "Loads/Score", 0);
        djSetInt(file, "Level/Admin level", 0);
        djSetInt(file, "Level/Vip level", 0);
        djSetInt(file, "Misc/Registered", 1);
        djSetInt(file, "Misc/Logged", 1);
        GivePlayerMoney(playerid, 500);
        djCommit(file);
        return 1;
       
    }
}
// Login dialog
if(dialogid == LOGIN)
{
    if(response)
    {
        new buffer[129];
        WP_Hash(buffer, sizeof buffer, inputtext);
        if(!strcmp(buffer, dj(file, "Important/Password"), false, 16))
        {
            new String[128], AdminStatus[128], VipStatus[128];
            GivePlayerMoney(playerid, djInt(file, "Loads/Money"));
            SetPlayerScore(playerid, djInt(file, "Loads/Score"));
            djSetInt(file, "Misc/Logged", 1);
            djCommit(file);
            return 1;
        }
       
    }
}
Well Lets Break it down. Lets Try Things see if it works and goes from there. Lets first try to see

Код:
if(!strcmp(buffer, dj(file, "Important/Password"), false, 16))
To

Код:
if(!strcmp(buffer, dj(file, "Important/Password"), true, 16))
Reply
#6

Well, if it's true, then it isnt case sensitive.
Reply
#7

oo then um idk xD
Reply
#8

Bump
Reply
#9

Anyone knows? Need to know whats wrong
Reply
#10

No one? :S
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)