Register Command with sscanf
#1

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

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!
Reply
#3

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
Reply
#4

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

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

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

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?
Reply
#8

Please remove dini... At lease use y_ini or be like me and make a saving system 4x+ faster then y_ini.
Reply
#9

Sorry. ok i'm changing dini to y_ini now.
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)