SA-MP Forums Archive
Change Password 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: Change Password Help (/showthread.php?tid=80546)



Change Password Help - Badger(new) - 04.06.2009

Hi, for somereason this change password command, which requires them to type their old pass and a new one doesn't work.

It says that you have typed a wrong old password and when I make it so you don't need the old password, it saves your password as nothing.

Here it is:
pawn Код:
//COMMAND: ChangePass
    if(strcmp(cmd,"/ChangePass",true)==0)
    {
      if(PINFO[playerid][Logged]==0)return SendClientMessage(playerid,ORANGE,"**(E)** This is a member command! (/Register) and get many other commands too!");
      new newpass[128];
      new oldpass[128];
      tmp=strtok(cmdtext,idx);
      if(strlen(tmp)==0)return SendClientMessage(playerid,GREY,"**(E)** You haven't typed all of the command! Type: (/ChangePass (OldPass) (NewPass)).");
      strmid(oldpass,tmp,0,strlen(tmp));
      if(PINFO[playerid][Password]!=strval(oldpass))return SendClientMessage(playerid,GREY,"**(E)** You haven't typed all of the command! Type: (/ChangePass (OldPass) (NewPass))");
      tmp=strtok(cmdtext,idx);
      if(strlen(tmp)==0)return SendClientMessage(playerid,GREY,"**(E)** You haven't typed all of the command! Type: (/ChangePass (NewPass)).");
      strmid(newpass,tmp,0,strlen(tmp));
      PINFO[playerid][Password]=strval(newpass);
      OnPlayerUpdate(playerid);
      SendClientMessage(playerid,LGREEN,"**(I)** You have successfully changed your password! Don't forget it.");
      return 1;
    }



Re: Change Password Help - lol2112 - 04.06.2009

A lot of admin scripts have working change password commands. You might want to check one of those out.


Re: Change Password Help - Badger(new) - 05.06.2009

I did but they use different systems e.g. MD5 dcmd


Re: Change Password Help - lol2112 - 05.06.2009

Here's one which does then:

Raptor - Advanced Admin Script [Pixels^]


Re: Change Password Help - Steve'95' - 30.03.2011

Код:
if(strcmp(cmd, "/changepass", true) == 0)
	{
		if(IsPlayerConnected(playerid))
		{
		    if(gPlayerLogged[playerid] == 0)
		    {
		        SendClientMessage(playerid, COLOR_GREY, "   You need to login first.");
		        return 1;
		    }
		    else
		    {
		    	SendClientMessage(playerid, COLOR_GREY, " ");
			}
			tmp = strtok(cmdtext, idx);
			if(!strlen(tmp))
			{
				SendClientMessage(playerid, COLOR_GRAD1, "USAGE: /changepass [password]");
				return 1;
			}
			strmid(PlayerInfo[playerid][pKey], tmp, 0, strlen(cmdtext), 255);
			OnPlayerUpdate(playerid);
			SendClientMessage(playerid, COLOR_YELLOW, "   Password has been changed successfuly");
		}
		return 1;
	}