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



Changepass - andreyysk - 18.06.2016

Hello,
How to make a command to change the password via the "DINI" please?


Re: Changepass - Backups - 18.06.2016

PHP код:
CMD:changepass(playerid,params[])
{
if(!
strlen(params))
{
SendClientMessage(playerid,-1,"Usage: /changepass (new pass)");
return 
1;
}
if(
strval(params) < 6
{
SendClientMessage(playerid,-1,"ERROR: Password 
Must be at least 6 characters"
);
return  
1;
}
if(
GetPlayerState(playerid) == PLAYER_STATE_WASTED
{
 
SendClientMessage(playerid,-1,"You are must be spawned!");
return 
1;
}
dUserSetINT(playerid).("Password",params);
new 
string[128];
format(string,sizeof string,"
You change the password %s"
,params);
SendClientMessage(playerid,-1,string);
return 
1;

Change the password by Mode
in the string


Re: Changepass - andreyysk - 18.06.2016

error 035: argument type mismatch (argument 1)

dUserSetINT(playerid).("Password",params);

Why?


Re: Changepass - Backups - 18.06.2016

ohh sorry change this
PHP код:
new name[24]; 
GetPlayerName(playerid,name,24);
dUserSetINT(name(playerid)).("Password",params); 



Re: Changepass - andreyysk - 18.06.2016

error 012: invalid function call, not a valid address
warning 215: expression has no effect
error 001: expected token: ";", but found ")"
error 029: invalid expression, assumed zero
fatal error 107: too many error messages on one line


line: dUserSetINT(name(playerid)).("Password",params);


Re: Changepass - Backups - 18.06.2016

Sorry I do not understand DINI . I'm understand MySQL.
The logic of trying to solve this


Re: Changepass - F1N4L - 18.06.2016

Try...
Код:
CMD:cpass(playerid, params[])
{
	new OldPass[129], NewPass[129], Name[24], FileName[40];
	if(sscanf(params, "s[129]s[129]", OldPass, NewPass)) return SendClientMessage(playerid, -1, "/cpass [old pass] [new pass]");
	
	GetPlayerName(playerid, Name, sizeof Name);
	format(FileName, sizeof FileName, "%s.inc", Name);
	
	if(strcmp(dini_Get(FileName, "password"), OldPass, false) == 0)
	{
		dini_Set(FileName, "password", NewPass);
		SendClientMessage(playerid, -1, "Password has been changed.");
	}
	else SendClientMessage(playerid, -1, "Old Password is wrong!");
	
	return 1;
}



Re: Changepass - andreyysk - 18.06.2016

Does not work. When I write random password instead of the old password, it writes that successfully changed. If I change the password so new, not saved new password.


Re: Changepass - F1N4L - 18.06.2016

Quote:
Originally Posted by andreyysk
Посмотреть сообщение
Does not work. When I write random password instead of the old password, it writes that successfully changed. If I change the password so new, not saved new password.
The line of password in file of the player is password? You are changed?


Re: Changepass - andreyysk - 18.06.2016

Now I write the old password correctly, but writes that it is wrong.