Changename command help
#1

HEllo i have made a changename command but i am having a problem with it
i get these errors that i dont understand some one help please

Code:
: warning 219: local variable "PlayerName" shadows a variable at a preceding level
 : error 017: undefined symbol "Account"
 : 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
Here its the command

Code:
COMMAND:changepass(playerid, params[])
{
    new file[30], PlayerName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PlayerName, MAX_PLAYER_NAME);
    if(Account[playerid][Logged] != 1) return SendClientMessage(playerid,Red,"You are not logged in, so you can't use this command!")
    if(strlen(params) >= 3)
    {
        format(file, sizeof(file), "Accounts/%s.txt", PlayerName);
        WP_Hash(buf, sizeof(buf), params);
        dini_Set(file, "Password");
        SendClientMessage(playerid,Green, "Your password has been succesfull changed!");
    }
    else
    {
        SendClientMessage(playerid, Red, "Your password need to be atleast 3 characters long!");
    }
    return 1;
}
Reply
#2

I think you must create enum for this error
Code:
error 017: undefined symbol "Account"
And for the for the PlayerName you only change the PlayerName to other thing
Code:
COMMAND:changepass(playerid, params[])
{
    new file[30], NameP[MAX_PLAYER_NAME];
    GetPlayerName(playerid, NameP, MAX_PLAYER_NAME);
    if(Account[playerid][Logged] != 1) return SendClientMessage(playerid,Red,"You are not logged in, so you can't use this command!")
    if(strlen(params) >= 3)
    {
        format(file, sizeof(file), "Accounts/%s.txt", NameP);
        WP_Hash(buf, sizeof(buf), params);
        dini_Set(file, "Password");
        SendClientMessage(playerid,Green, "Your password has been succesfull changed!");
    }
    else
    {
        SendClientMessage(playerid, Red, "Your password need to be atleast 3 characters long!");
    }
    return 1;
}
I hope it's help
Reply
#3

Well it its not working same errors/warns
Reply
#4

pawn Code:
COMMAND:changepass(playerid, params[])
{
    if(Account[playerid][Logged] != 1) return SendClientMessage(playerid,Red,"You are not logged in, so you can't use this command!")
    if(!(strlen(params) >= 3)) return SendClientMessage(playerid, Red, "Your password need to be atleast 3 characters long!");

    new file[40], pName[MAX_PLAYER_NAME+1];
    GetPlayerName(playerid, pName, MAX_PLAYER_NAME+1);

    format(file, sizeof(file), "Accounts/%s.txt", pName);
    WP_Hash(buf, sizeof(buf), params);
    dini_Set(file, "Password", buf);
   
    SendClientMessage(playerid,Green, "Your password has been succesfull changed!");

    return 1;
}
Reply
#5

Well still wont work nevermind it
Reply
#6

Quote:
Originally Posted by Diti1
View Post
Well still wont work nevermind it
Errors/Warns ?
Reply
#7

same
Reply
#8

Show the line where there are errors & warns, and your enum and variable
Reply
#9

i will give you all my start of changepass


Code:
public OnDialogResponse(playerid, dialogid, response, listitem, inputtext[])
{	
        if(dialogid == 3 && response == 1)
	{
	    dcmd_changepass(playerid, inputtext);
	    return 1;
	}
Code:
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
#10

Actually, you use dcmd or zcmd ?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)