Getting error when checking pass - 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: Getting error when checking pass (
/showthread.php?tid=131329)
Getting error when checking pass -
Desert - 02.03.2010
I was working on an account filterscript. This is my second time trying to make 1. And last time it all went very buggy. So i didn't want to copy paste it and i wanted to make it with dcmd as im shit at strcmp.
I came up with this script
Код:
dcmd_login(playerid,params[])
{
new pass,rpass,name[MAX_PLAYER_NAME],file[23],string[76];
if(logged[playerid] == 1) return SendClientMessage(playerid,COLOUR_RED,"You are already logged in!");
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file)) return SendClientMessage(playerid,COLOUR_RED,"You don't have an account! Register yourself with /register [Password]");
if(sscanf(params,"s",pass)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /login [Password]");
rpass = dini_Int(file,"Password");
if(udb_hash(pass) == rpass)
{
pi[playerid][Adminlevel] = dini_Int(file,"Adminlevel");
pi[playerid][Stat] = dini_Int(file,"Stat");
format(string,sizeof(string),"Welcome back %s! You have been succesfully been logged in",name);
SendClientMessage(playerid,COLOUR_GREEN,string);
logged[playerid] = 1;
return 1;
}
else return SendClientMessage(playerid,COLOUR_RED,"The password was incorrect!");
}
And it gives error (109) : error 035: argument type mismatch (argument 1)
The error line is if(udb_hash(pass) == rpass)
Re: Getting error when checking pass -
wafffllesss - 02.03.2010
pawn Код:
dcmd_login(playerid,params[])
{
new pass,rpass[256],name[MAX_PLAYER_NAME],file[23],string[76];
if(logged[playerid] == 1) return SendClientMessage(playerid,COLOUR_RED,"You are already logged in!");
GetPlayerName(playerid,name,sizeof(name));
format(file,sizeof(file),"%s.ini",name);
if(!fexist(file)) return SendClientMessage(playerid,COLOUR_RED,"You don't have an account! Register yourself with /register [Password]");
if(sscanf(params,"s",pass)) return SendClientMessage(playerid,COLOUR_RED,"Usage: /login [Password]");
format(rpass,sizeof(rpass),"%s",dini_Str(file,"Password")); // Check this out... did not knot what is te dini cmd for Strings...
if(!strcmp(udb_hash(pass),rpass))
{
pi[playerid][Adminlevel] = dini_Int(file,"Adminlevel");
pi[playerid][Stat] = dini_Int(file,"Stat");
format(string,sizeof(string),"Welcome back %s! You have been succesfully been logged in",name);
SendClientMessage(playerid,COLOUR_GREEN,string);
logged[playerid] = 1;
return 1;
}
else return SendClientMessage(playerid,COLOUR_RED,"The password was incorrect!");
}
Re: Getting error when checking pass -
Desert - 02.03.2010
EDIT: Problem fixed! Thanks waffffllesss you inspired me to make the solution