/changepass problem
#1

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

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

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

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.
Reply
#5

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")
Reply
#6

Read my post again please.
Reply
#7

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

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!");

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)