08.07.2017, 05:53
Here, I'm not all that sure why you're asking for two instances of the password in the params and then in the inputtext. But I tried to help you out a bit. Hopefully it helps.
Код:
dcmd_changepass(playerid,params[])
{
if(!strcmp(params,"666",true))
{
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "> Password", "Please enter your new password.", "Change", "Cancel");
}
if (strlen(params) < 3 || strlen(params)>14)
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Error, the password needs to be between 5 and 14 characters");
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "> Password", "Please enter your new password.", "Change", "Cancel");
}
new newpass;
new mess[MAX_STRING];
newpass=udb_hash(params);
dUserSetINT(PlayerName(playerid)).("password_hash",newpass);
format(mess,sizeof(mess),"..: SUCCESS: Your password has been changed. :..",newpass);
SendClientMessage(playerid,COLOR_SYSTEM_GM,mess);
return 1;
}
public OnDialogResponse(playerid,dialogid,reponse,listitem,inputtext[])
{
switch(dialogid)
{
case 3:
{
if(!response) return SendClientMessage(playerid, COLOR_SYSTEM_GM, "You have closed out of the password menu");
if(response)
{
if (strlen(inputtext) < 3 || strlen(inputtext)>14)
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Error, the password needs to be between 5 and 14 characters");
ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "> Password", "Please enter your new password.", "Change", "Cancel");
}
new newpass;
new mess[MAX_STRING];
newpass=udb_hash(params);
dUserSetINT(PlayerName(playerid)).("password_hash",newpass);
format(mess,sizeof(mess),"..: SUCCESS: Your password has been changed. :..",newpass);
SendClientMessage(playerid,COLOR_SYSTEM_GM,mess);
}
}
}
return 1;
}

