Changepassword Command -
Lixyde - 07.03.2018
First of all, im new, and im sorry if my english is bad:
So as the title says: I want a /changepassword command in ZCMD.
I searched for it but none of them worked, also to know i use udb_hash
Here it is:
stock udb_hash(buf[])
{
new length=strlen(buf);
new s1 = 1;
new s2 = 0;
new n;
for (n=0; n<length; n++)
{
s1 = (s1 + buf[n]) % 65521;
s2 = (s2 + s1) % 65521;
}
return (s2 << 16) + s1;
}
And i use this register/login system:
https://sampforum.blast.hk/showthread.php?tid=273088
If this is enough please, tell me how to do it, or give me the command that you created for me
(Or something like that)
And thanks anyway
Re: Changepassword Command -
AroseKhanNiazi - 07.03.2018
Use, params to check if the password is valid. Once it is, to save password
PHP код:
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(params));
INI_Close(File);
Re: Changepassword Command -
Lixyde - 08.03.2018
Can you please give me a sample or command how to do it because i don't understand :/
Re: Changepassword Command -
AroseKhanNiazi - 08.03.2018
PHP код:
CMD:changepassword(playerid,params[])
{
new size=strlen(params);
if(size > 15 || size < 3) return SendClientMessage(playerid,-1,"Password should be between 3-15 characters.");
new INI:File = INI_Open(UserPath(playerid));
INI_SetTag(File,"data");
INI_WriteInt(File,"Password",udb_hash(params));
INI_Close(File);
SendClientMessage(playerid,-1,"Password changed");
return 1;
}
Remember this is a working example, but you must always check if the player is logged in before he uses this command.
Re: Changepassword Command -
Lixyde - 08.03.2018
Thank you! This for me works! Perfectly! Also do i have anything else to add?
Or this is the full command?
Re: Changepassword Command -
AroseKhanNiazi - 08.03.2018
This should work completely, but if you have something as login check add that before using any command.
Re: Changepassword Command -
Lixyde - 08.03.2018
Ok thanks! Admins can close this thread.