Command doesn't exist!
#1

Help with this!

pawn Код:
dcmd_changepass(playerid,params[])
{
  if(!strcmp(params,"666",true))
  {
      ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "> Password", "Please enter your new password.", "Change", "Cancel");
     return 1;
  }
    if (strlen(params) < 3)
  {
    SendClientMessage(playerid,COLOR_SYSTEM_GM,"Error, the password is too short");
    ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "> Password", "Please enter your new password.", "Change", "Cancel");
     return 1;
  }
  if(strlen(params)>14)
  {
      SendClientMessage(playerid,COLOR_SYSTEM_GM,"Error, the password is too long");
      ShowPlayerDialog(playerid, 3, DIALOG_STYLE_PASSWORD, "> Password", "Please enter your new password.", "Change", "Cancel");
     return 1;
  }
  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;
}
Reply
#2

Not too sure what's going on in the command at the bottom, but I'm pretty sure
Код:
newpass=udb_hash(params);
is causing some issues, not sure how the compiler missed that but replace it with
Код:
new pass=udb_hash(params);
Also, you should use a different command processor as dcmd is known to be inefficent compared to others like IZCMD.
Reply
#3

Quote:
Originally Posted by DTV
Посмотреть сообщение
Not too sure what's going on in the command at the bottom, but I'm pretty sure
Код:
newpass=udb_hash(params);
is causing some issues, not sure how the compiler missed that but replace it with
Код:
new pass=udb_hash(params);
Also, you should use a different command processor as dcmd is known to be inefficent compared to others like IZCMD.
Read his code again, newpass is a variable.
Reply
#4

fixed. thank you anyways.
Reply
#5

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;
}
Reply
#6

Quote:
Originally Posted by Tass007
Посмотреть сообщение
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;
}
My /changepass is working fine right now but yours are interesting. Tried your code but receive this error.
pawn Код:
(7564) : error 017: undefined symbol "params"
(30796) : warning 203: symbol is never used: "dcmd_changepass"

7574 = newpass=udb_hash(params);
30796 = the end of the script.
Reply
#7

Hmm... Well first things first.
Код:
newpass=udb_hash(params);
Needs to be changed to
Код:
newpass=udb_hash(inputtext);
The code compiles fine for me on the symbol is never used, I am using zCMD, and obviously I don't have all your data files etc...

Код:
CMD: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];
//	WP_Hash(newpass, sizeof(newpass),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,response,listitem,inputtext[])
{
	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];
	//		WP_Hash(newpass, sizeof(newpass),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;
}
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)