SA-MP Forums Archive
change password - 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)
+--- Thread: change password (/showthread.php?tid=610089)



change password - andreyysk - 19.06.2016

Hi, I need to put in command udb_hash, but it fails. How to do it please?

[QUOTE{
new OldPass[129], NewPass[129], Name[24], Slozka[40];
if(sscanf(params, "s[129]s[129]", OldPass, NewPass))
return SendClientMessage(playerid, COLOR_RUZOVA, "/changepass [old pass] [new pass]");
GetPlayerName(playerid, Name, sizeof (Name));
format(Slozka, sizeof (Slozka), "/Ucty/%s.ini", Name);

if(!strcmp(dini_Get(Slozka,"Password"), OldPass, false))
{
[/QUOTE]


Re: change password - andreyysk - 20.06.2016

help me please


Re: change password - Matz - 20.06.2016

Код:
dcmd_heslo(playerid, params[])
{
	new OldPass[129], NewPass[129], Name[24], Slozka[64];
	if(sscanf(params, "s[129]s[129]", OldPass, NewPass)) return SendClientMessage(playerid, COLOR_RUZOVA, "/changepass [starй heslo] [novй heslo]");
	GetPlayerName(playerid, Name, sizeof (Name));
	format(Slozka, sizeof (Slozka), "/Ucty/%s.ini", Name);
	if(strcmp(OldPass, Slozka) == 0)
	{
		dini_Set(Slozka, "Password", NewPass);
		SendClientMessage(playerid, COLOR_RUZOVA, "Heslo zmeneno");
	}
	else return SendClientMessage(playerid, cervena, "bad pass");
	return 1;
}



Re: change password - andreyysk - 20.06.2016

I need a new password to be saved as "udb hash" otherwise it would not work...

My code:
Quote:

dcmd_changepass(playerid, params[])
{
new OldPass[129], NewPass[129], Name[24], Slozka[40];
if(sscanf(params, "s[129]s[129]", OldPass, NewPass))
return SendClientMessage(playerid, COLOR_RUZOVA, "/changepass [old pass] [new pass]");
GetPlayerName(playerid, Name, sizeof (Name));
format(Slozka, sizeof (Slozka), "/Ucty/%s.ini", Name);

if(!strcmp(dini_Get(Slozka,"Password"), OldPass, false))
{
dini_Set(Slozka, "Password", NewPass);
SendClientMessage(playerid, COLOR_RUZOVA, "pass changed");
}
else
SendClientMessage(playerid, cervena, "bad pass");
return 1;
}