Register Command with sscanf -
Reklez - 10.03.2012
hey guys i'm creating my rank system. i decide to make a rank system that doesn't use a register dialog
here is my code. My Code is not finish yet
pawn Код:
CMD:register(playerid, params[])
{
new pass;
if(IsPlayerRegister[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You are already registered!");
if(sscanf(params, "i", pass)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /register [pass]");
format(file, sizeof(file), "Rank/Users/%s.ini", pName(playerid));
if(fexist(file)) return SendClientMessage(playerid, COLOR_RED, "Your account is already registered from our database");
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(pass));
}
return 1;
}
i got this error
Код:
error 035: argument type mismatch (argument 1)
one question how can i use sscanf in making /login and /register
Re: Register Command with sscanf -
Ballu Miaa - 10.03.2012
Give me the line on which you're getting this error!
Secondly IsPlayerRegister[playerid] == 1 is a one dimensional array? But that doesnt save up for any player!
Where else you have used IsPlayerRegister. Show me maybe i can make your script a bit better!
Re: Register Command with sscanf -
Reklez - 10.03.2012
the error are at line 80 and heres the code at line 80
pawn Код:
dini_IntSet(file, "Password", udb_hash(pass));
i use IsPlayerRegister after the dini_Create
Re: Register Command with sscanf -
Ballu Miaa - 10.03.2012
Quote:
Originally Posted by Reklez
the error are at line 80 and heres the code at line 80
pawn Код:
dini_IntSet(file, "Password", udb_hash(pass));
i use IsPlayerRegister after the dini_Create
|
That doesnt seem as a problem to me what the fuck. Lemme recheck!
Re: Register Command with sscanf -
FarSe. - 10.03.2012
pawn Код:
CMD:register(playerid, params[])
{
if(IsPlayerRegister[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You are already registered!");
if(sscanf(params, "s[40]", params[1])) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /register [params[1]]");
format(file, sizeof(file), "Rank/Users/%s.ini", pName(playerid));
if(fexist(file)) return SendClientMessage(playerid, COLOR_RED, "Your account is already registered from our database");
if(!dini_Exists(file))
{
dini_Create(file);
dini_IntSet(file, "password", udb_hash(params[1]));
}
return 1;
}
works only with sscanf-plugin.
Re: Register Command with sscanf -
eesh - 10.03.2012
pawn Код:
CMD:register(playerid, params[])
{
new pass[32];//needs to be a string
if(IsPlayerRegister[playerid] == 1) return SendClientMessage(playerid, COLOR_RED, "You are already registered!");//s for sting not i as password is string initially
if(sscanf(params, "s", pass)) return SendClientMessage(playerid, COLOR_RED, "SYNTAX: /register [pass]");
format(file, sizeof(file), "Rank/Users/%s.ini", pName(playerid));
if(!dini_Exists(file)) return SendClientMessage(playerid, COLOR_RED, "Your account is already registered from our database");
dini_Create(file);
dini_IntSet(file, "Password", udb_hash(pass));
return 1;
}
Re: Register Command with sscanf -
Reklez - 10.03.2012
one question i'm making a test speed between my Admin System [FS] and LuxAdmin
pawn Код:
new a = 0;
new tick[2];
tick[0] = GetTickCount();
while(a < 100000) { printf("Process: %d",a); a++; }
tick[1] = GetTickCount();
printf("Process complete.\nTime taken: %d",tick[1]-tick[0]);
that is what i'm using for test speed. now
the question
Код:
Highest - Fastest
Lowest - Slowest
is this correct?
Re: Register Command with sscanf -
AustinJ - 10.03.2012
Please remove dini... At lease use y_ini or be like me and make a saving system 4x+ faster then y_ini.
Re: Register Command with sscanf -
Reklez - 10.03.2012
Sorry. ok i'm changing dini to y_ini now.
Re: Register Command with sscanf -
AustinJ - 10.03.2012
Well you see dini is very slow. this is what I used to use when my server was early in development. When I would save my systems my server would lag on my my computer for a minute. It takes years for it save when you have mass amounts of data. You'll understand when you have more systems saving with more data. Basically dini is opening the file then closing for each variable where y_ini will keep the file open then close it when all the variables are written that goto that file.