SA-MP Forums Archive
/changepass problem - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: /changepass problem (/showthread.php?tid=269549)



/changepass problem - Amine_Mejrhirrou - 16.07.2011

i have this error msg and still don't know why i have it
error 035: argument type mismatch (argument 1)
Код:
CMD:changepass(playerid, params[])
{
	new file[128];
	format(file, 128, USER_FILE, GetPName(playerid));
    new OldPass, NewPass;
    if(sscanf(params, "ss", OldPass, NewPass)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /changepass (password) (new password)");
    if(OldPass == NewPass) return SendClientMessage(playerid, COLOR_RED, "ERROR: You typed same password");
	dini_IntSet(file, "Password", udb_hash(NewPass));	
    SendClientMessage(playerid, COLOR_RED, "You have changed your password.");
    return 1;
}



Re: /changepass problem - Vince - 16.07.2011

pawn Код:
new OldPass, NewPass;
Need to be strings, obviously.


Re : /changepass problem - Amine_Mejrhirrou - 16.07.2011

both of them ?
cause it gave me that
error 033: array must be indexed (variable "OldPass")


Re: Re : /changepass problem - Kyosaur - 16.07.2011

Quote:
Originally Posted by Amine_Mejrhirrou
Посмотреть сообщение
both of them ?
cause it gave me that
error 033: array must be indexed (variable "OldPass")
Yes, both of them as they are indeed strings. You compare strings using the function strcmp, so change you're same password check to use that.


Also, you should make sure the old pass matches the actual old password before setting a new one.


Re : Re: Re : /changepass problem - Amine_Mejrhirrou - 16.07.2011

Quote:
Originally Posted by Kyosaur
Посмотреть сообщение
Yes, both of them as they are indeed strings. You compare strings using the function strcmp, so change you're same password check to use that.


Also, you should make sure the old pass matches the actual old password before setting a new one.
to check if the player didn't tape the same pass i use this
Код:
if(OldPass == NewPass) return SendClientMessage(playerid, COLOR_RED, "ERROR: You typed same password");
now even if i put strings for OldPass and NewPass , i still havng errors ...
i'll show you the commande maybe you could help me
Код:
CMD:changepass(playerid, params[])
{
	new file[128];
	format(file, 128, USER_FILE, GetPName(playerid));
    new OldPass[50], NewPass[50];
    if(sscanf(params, "ss", OldPass, NewPass)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /changepass (password) (new password)");
    if(OldPass == NewPass) return SendClientMessage(playerid, COLOR_RED, "ERROR: You typed same password");
	dini_IntSet(file, "Password", udb_hash(NewPass));	
    SendClientMessage(playerid, COLOR_RED, "You have changed your password.");
    return 1;
}
and this is the error
error 032: array index out of bounds (variable "OldPass")


Re: /changepass problem - Kyosaur - 16.07.2011

Read my post again please.


Re: /changepass problem - PotH3Ad - 16.07.2011

He is using udbhash.

Give this a try:

pawn Код:
CMD:changepass(playerid, params[])
{
    new file[128];
    format(file, 128, USER_FILE, GetPName(playerid));
    new OldPass[80], NewPass[80];

    if(sscanf(params, "ss", OldPass, NewPass)) return SendClientMessage(playerid, COLOR_RED, "USAGE: /changepass (password) (new password)");
    if(udb_hash(OldPass) != udb_hash(dini_Int(file, "Password"))) return SendClientMessage(playerid, COLOR_RED, "ERROR: Your old password does not match!");
    if(udb_hash(OldPass) == udb_hash(NewPass)) return SendClientMessage(playerid, COLOR_RED, "ERROR: You typed same password");

    dini_IntSet(file, "Password", udb_hash(NewPass));
    SendClientMessage(playerid, COLOR_RED, "You have changed your password.");
    return 1;
}



Re : /changepass problem - Amine_Mejrhirrou - 16.07.2011

thank you PotH3Ad your script works perfectly for me (i delete this because of an error)
Quote:

if(udb_hash(OldPass) != udb_hash(dini_Int(file, "Password"))) return SendClientMessage(playerid, COLOR_RED, "ERROR: Your old password does not match!");