SA-MP Forums Archive
changepassword command - 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: changepassword command (/showthread.php?tid=610550)



changepassword command - andreyysk - 25.06.2016

Hello, I need a command to change the password. Player must write old password and new password. I need to load your password via udb_hash and also are saved. Will you help me please? + REP.

MY CODE:
Код:
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;
}



Re: changepassword command - AlonzoTorres - 25.06.2016

What errors do you get? What exactly do you expect us to do with that code? If you want someone to completely rewrite your code then this is the wrong section. Here you come with a problem and is given a solution. Not lots of code and a simple request to fix a system for you. Also I would say its bad practice to mix English and whatever language you are using there.