Djson help - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (
https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (
https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (
https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Djson help (
/showthread.php?tid=267167)
Djson help -
Wesley221 - 07.07.2011
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;
}
}
}
Re: Djson help -
Wesley221 - 07.07.2011
Anyone knows?
Re: Djson help -
Wesley221 - 08.07.2011
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
}
}
Re: Djson help -
Wesley221 - 08.07.2011
Anyone?
Re: Djson help -
HayZatic - 08.07.2011
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))
Re: Djson help -
Wesley221 - 08.07.2011
Well, if it's true, then it isnt case sensitive.
Re: Djson help -
HayZatic - 08.07.2011
oo then um idk xD
Re: Djson help -
Wesley221 - 09.07.2011
Bump
Re: Djson help -
Wesley221 - 09.07.2011
Anyone knows? Need to know whats wrong
Re: Djson help -
Wesley221 - 10.07.2011
No one? :S