Problem regarding changepass cmd.
#1

Hello. I made a command to change the password of a certain acc.
Код:
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;
}
Unfortunately, all other commands are made in ZCMD and I need help to see why it does not work..
Reply
#2

Just change:
pawn Код:
dcmd_changepass(playerid,params[])
to:
pawn Код:
CMD:changepass(playerid,params[])
Reply
#3

I changed , but after I did I got this error
Quote:

C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(7103) : error 017: undefined symbol "dcmd_changepass"
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(29250) : warning 203: symbol is never used: "changepass"

And if i change it to CMD:changepass(playerid, inputtext);

I get these's
Quote:

C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(9500) : warning 208: function with tag result used before definition, forcing reparse
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(7103) : warning 221: label name "CMD" shadows tag name
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(7103) : warning 203: symbol is never used: "CMD"
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(9505) : warning 213: tag mismatch
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(9511) : warning 213: tag mismatch
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(9517) : warning 213: tag mismatch
C:\Users\Valentin$\Desktop\Server - Real one\Server - Real one\EMRP 0.3z\gamemodes\lvrp.pwn(9525) : warning 213: tag mismatch
Pawn compiler 3.2.3664 Copyright © 1997-2006, ITB CompuPhase

Reply
#4

dcmd is having also its definition in OnPlayerCommandText callback. ZCMD is not using this callback anymore, and having its own two callbacks. Please, make sure that you don't have anything in gamemode related to DCMD by simply doing Search function combination and typing in "dcmd". If you gonna find anything, please just post it here, because with error we can't really help you, since we don't see your code.
Reply
#5

Quote:

#define dcmd(%1,%2,%3) if ((strcmp(%3, "/%1", true, %2+1) == 0)&&(((%3[%2+1]==0)&&(dcmd_%1(playerid,"")))||((%3[%2+1]==32)&&(dcmd_%1(playerid,%3[%2+2]))))) return 1

Quote:

if(dialogid == 1 && response == 1 || dialogid == 1 && response == 0)
{
dcmd_registerex(playerid, inputtext);
return 1;
}
if(dialogid == 2 && response)
{
dcmd_loginex(playerid, inputtext);
return 1;
}
else if(dialogid == 2 && !response) return Kick(playerid);
if(dialogid == 3 && response == 1)
{
dcmd_changepass(playerid, inputtext);
return 1;
}
else if(dialogid == 3 && response == 0) return SendClientMessage(playerid, COLOR_RED, "Cancelled.");

Quote:

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;
}

Quote:

dcmd_registerex(playerid,params[])
{

if (PLAYERLIST_authed[playerid]) return SendClientMessage(playerid,COLOR_SYSTEM_GM,"Alread y authed.");
if (strlen(params) < 3 || strlen(params) > 15 || !strlen(params))
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Error, the password can contain only numbers");
ShowPlayerDialog(playerid, 1, DIALOG_STYLE_PASSWORD, " Account Register", "Please enter a password to register!", "Register", " ");
return 1;
}

Quote:

dcmd_loginex(playerid, params);
return 1;
}

Quote:

dcmd_loginex(playerid,params[])
{
if (PLAYERLIST_authed[playerid])
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Alread y authed.");
return 1;
}
if(strlen(params) > 32 || !strlen(params))
{
//ircecho("unformatted %s(%d) Typed too long password",PlayerName(playerid),playerid);
SendClientMessage(playerid,COLOR_SYSTEM_GM," Invalid password!");
ShowPlayerDialog(playerid, 2, DIALOG_STYLE_PASSWORD, " American Mafia | Account Login", "Please enter your password in order to login.\n\nIf you have lost it, please contact http://americanmafia.forumcreativ.com", "Login", " ");
return 1;
}
if (!udb_Exists(PlayerName(playerid)))
{
SendClientMessage(playerid,COLOR_SYSTEM_GM,"Error! Wrong Dialog.");
return 1;
}
if (udb_CheckLogin(PlayerName(playerid),params))
{
myStrcpy(PlayerTemp[playerid][password], MD5_Hash(params));
if(debuglvl>=3)

Quote:

COMMAND:login(playerid, params, inputtext[])
{
dcmd_loginex(playerid, inputtext);
return 1;
}
COMMAND:reg(playerid, params,inputtext[])
{
dcmd_registerex(playerid, inputtext);
return 1;
}

That's every dcmd from my script. I just want /changepass to work.
Reply
#6

So, you have to decide, if you want to use either ZCMD or DCMD. If you want to use ZCMD, just convert everything what you've got in DCMD to ZCMD.

For example that:
pawn Код:
dcmd_loginex(playerid,params[])
will be that:
pawn Код:
CMD:loginex(playerid,params[])
And you won't need OnPlayerCommandText callback anymore, you can just literally delete it, if you are not having any commands in there! You have to decide what command processor you want to use.
Reply
#7

Okay, Let's say i want to let it dcmd, but why does /changepass not working?
Reply
#8

A combination of ZCMD and DCMD in the server, will not function properly.
You either should use zcmd or dcmd.
Reply
#9

If i change to ZCMD, the "loginex", "registerex" w/e gets undefined symbol
Reply
#10

That's easy to fix!

If you'd add a command this way: CMD:mycommand(playerid, params[]), you can call it with "cmd_mycommand(playerid, params[])". 'CMD:' is just a macro, and the pre-compiler changes it to "cmd_".
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)