Please help with Administration system...
#1

Hello, I have got a problem...
I've been creating an Administration system..
And when I login it sayies that player isn't registered, but if I login it logins perfectly...

what should I do?

P.S. I don't get any errors...

Script: http://pastebin.com/m567c6544

Thanks for help, Alive.
Reply
#2

hope someone helps you, cause I ain\'t got an idea what do you mean by "And when I login it sayies that player isn\'t registered, but if I login it logins perfectly... "
Reply
#3

[code=Lithuanian]„Kai prisijungiu meta zinute tipo as neuzsiregines, nors anksciau jau buvau uzsiregistraves, ir kai rasau /login password viskas normaliai prisijungia...“ Ką daryt? praљau, padėkit man...

Aљ lietuvis. Kaip supratau iљ nick tu irgi... c(:
[/code]


[code=English]„I mean, when I login I get an message which says, that I am not registered yet, (but I am already some time ago), an if I type /login password it logs me in perfectly...“ What should I do? please, help me.. [/code]
Reply
#4

you mean when you connect it says that you are not registred, ([SERVER]Account %s isn\'t registered. Register using /register password") but when u use /login [password] it logs in correctly?

before you said when u login you get that message and then when u login it works fine - makes no sense.

Quote:
Originally Posted by ·٠•●°Alive°●•٠·
And when I login it sayies that player isn\'t registered, but if I login it logins perfectly...
Reply
#5

Quote:
Originally Posted by [B2K
Hustler ]
you mean when you connect it says that you are not registred, ([SERVER]Account %s isn\'t registered. Register using /register password") but when u use /login [password] it logs in correctly?

before you said when u login you get that message and then when u login it works fine - makes no sense.

Quote:
Originally Posted by ·٠•●°Alive°●•٠·
And when I login it sayies that player isn\'t registered, but if I login it logins perfectly...
yeah, I mean that :P
Reply
#6

oh yeh i forgot to ask you, does it also say:

[SERVER]Welcome back %s! Please login. when you connect?

If so, it probably means your ip does not match with the account file. Do you have dynamic ip?

I got to go now, so i won\'t be able to reply until i get back. Good luck.

Reply
#7

You are using dcmd and strtok at the same time!? shame on you!

dcmd was special designed to NOT use and avoid using strtok, and what are you doing? you are using strtok!
Using size 256 for cmd tmp & string array? change string array to 128, cmd and tmp to 32 or something, you are wasting memory.
And you just copied whole thing from PEN of GF, you are sad!
Reply
#8

Andom, can you help me with that? I would be very mad if you help me.
Reply
#9

show the code that says that your not registerred.
Reply
#10

pawn Code:
298.public OnPlayerConnect(playerid)
299.{
300.    new string[256];
301.    new playrname[MAX_PLAYER_NAME];
302.    new planame[MAX_PLAYER_NAME];
303.    new connect[128], string2[256];
304.  new pName[MAX_PLAYER_NAME];
305.  new jstring[48];
306.
307.    GetPlayerName(playerid, planame, sizeof(planame));
308.    GetPlayerName(playerid, playrname, sizeof(playrname));
309.  GetPlayerName(playerid, pName, sizeof(pName));
310.    format(connect, sizeof(string), "Admin/Users/%s.djson", playrname);
311.    format(string2, sizeof(string2), "Admin/Users/%s.djson", playrname);
312.    
313.    PlayerInfo[playerid][pLevel] = 0;
314.    PlayerInfo[playerid][pKills] = 0;
315.    PlayerInfo[playerid][pDeaths] = 0;
316.    PlayerInfo[playerid][pCash] = 0;
317.    
318.    gPlayerLogged[playerid] = 0;
319.    
320.  format(jstring, sizeof(jstring), "***%s has joined the server.", pName);
321.  SendClientMessageToAll(0xAAAAAAAA, jstring);
322.
323.    if(fexist(connect))
324.    {
325.        new tmp[50],tmp2[256];
326.        GetPlayerIp(playerid,tmp,50);
327.        tmp2 = dini_Get(connect,"IP");
328.        if(!strcmp(tmp,tmp2,true))
329.        {
330.            format(string, sizeof(string), "[SUCESS]%s, you have been automatically logged in.", playrname);
331.            SendClientMessage(playerid, COLOR_GREEN, string);
332.            gPlayerLogged[playerid] = 1;
333.            new playername2[MAX_PLAYER_NAME];
334.            GetPlayerName(playerid, playername2, sizeof(playername2));
335.            format(string2, sizeof(string2), "Admin/Users/%s.ini", playername2);
336.            new File: UserFile = fopen(string2, io_read);
337.            if ( UserFile )
338.            {
339.                new PassData[256];
340.                new keytmp[256], valtmp[256];
341.                fread( UserFile , PassData , sizeof( PassData ) );
342.                keytmp = ini_GetKey( PassData );
343.                if( strcmp( keytmp , "Password" , true ) == 0 )
344.                {
345.                    valtmp = ini_GetValue( PassData );
346.                    strmid(PlayerInfo[playerid][pPassword], valtmp, 0, strlen(valtmp)-1, 255);
347.                    new key[ 256 ] , val[ 256 ];
348.                    new Data[ 256 ];
349.                    while ( fread( UserFile , Data , sizeof( Data ) ) )
350.                    {
351.                        key = ini_GetKey( Data );
352.                        if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
353.                        if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
354.                        if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
355.                        if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
356.                    }
357.                    fclose(UserFile);
358.                    gPlayerLogged[playerid] = 1;
359.                }
360.            }
361.        }
362.        else
363.        {
364.            gPlayerAccount[playerid] = 1;
365.            format(string, sizeof(string), "[SERVER]Welcome back %s! Please login.", playrname);
366.            SendClientMessage(playerid, COLOR_YELLOW, string);
367.            gPlayerLogged[playerid] = 0;
368.            return 1;
369.        }
370.    }
371.    else
372.    {
373.        gPlayerAccount[playerid] = 0;
374.        format(string, sizeof(string),"[SERVER]Account %s isn\'t registered. Register using /register password", playrname);
375.        SendClientMessage(playerid, COLOR_YELLOW,string);
376.        gPlayerLogged[playerid] = 0;
377.        return 1;
378.    }
379.    return 1;
380.}
Reply
#11

well that script is a complete mess. You Auto log them in by using their ip, but for some reason you check their password. Hmm?

Also, I\'m a little confused. You\'re saving the files as .djson ? Wouldn\'t it make more sense to save them as .ini? And I checked the rest of your script, it\'s saving it as .ini, thats probably why it wont auto log you in as there is a file called (yourname).ini, but not one called (yourname).djson.

anyway here it is:
pawn Code:
public OnPlayerConnect(playerid)
{//New\'s
    new string[256];
    new PNAME[MAX_PLAYER_NAME];
    GetPlayerName(playerid, PNAME, sizeof(PNAME));
    //PlayerInfo == 0
    PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pCash] = 0;
    gPlayerAccount[playerid] = 0;
    gPlayerLogged[playerid] = 0;
    //Connect Message
    format(string, sizeof(string), "***%s has joined the server.", PNAME);
    SendClientMessageToAll(0xAAAAAAAA, string);
    //Does Account Exist?
    format(string, sizeof(string), "Admin/Users/%s.ini", PNAME);
    if(fexist(string))
    {
      gPlayerAccount[playerid] = 1;
      //IP Checker
        new IP[20];
        new IP2[20]=dini_Get(string,"IP");
        GetPlayerIp(playerid,IP,sizeof(IP));
        if(strcmp(IP,IP2,true)==0)
        {
            new key[256] , val[256];
            new Data[256];
            while (fread(string,Data,sizeof(Data)))
            {
                key = ini_GetKey( Data );
                if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
                if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
                if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
            }
            fclose(UserFile);
            gPlayerLogged[playerid] = 1;
            format(string, sizeof(string), "[SUCESS]%s, you have been automatically logged in.", PNAME);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }
        else
        {
            format(string, sizeof(string), "[SERVER]Welcome back %s! Please login.", PNAME);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
    }
    else
    {
        format(string, sizeof(string),"[SERVER]Account %s isn\'t registered. Register using /register password",PNAME);
        SendClientMessage(playerid, COLOR_YELLOW,string);
        return 1;
    }
    return 1;
}
Reply
#12

Thanks.
Reply
#13

pawn Code:
public OnPlayerConnect(playerid)
{
    new string[256];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pCash] = 0;
    gPlayerAccount[playerid] = 0;
    gPlayerLogged[playerid] = 0;

    //Does Account Exist?
    format(string, sizeof(string), "Users/%s.ini", pName);
    if(fexist(string))
    {
        gPlayerAccount[playerid] = 1;
        //IP Checker
        new IP[20];
        new IP2[20] = dini_Get(string,"IP");
        GetPlayerIp(playerid,IP,sizeof(IP));
       
        if(strcmp(IP,IP2,true)==0)
        {
            new key[256] , val[256];
            new Data[256];
            while (fread(string,Data,sizeof(Data)))
            {
                key = ini_GetKey( Data );
                if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
                if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
                if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
            }
            fclose(UserFile);
            gPlayerLogged[playerid] = 1;
            format(string, sizeof(string), "[SUCESS]%s, you have been automatically logged in.", pName);
            SendClientMessage(playerid, COLOR_GREEN, string);
        }
        else
        {
            format(string, sizeof(string), "[SERVER]Welcome back %s! Please login.", pName);
            SendClientMessage(playerid, COLOR_YELLOW, string);
            return 1;
        }
    }
    else
    {
        format(string, sizeof(string),"[SERVER]Account %s isn\'t registered. Register using /register password",pName);
        SendClientMessage(playerid, COLOR_YELLOW,string);
        return 1;
    }
    return 1;
}
line 318 - new IP2[20] = dini_Get(string,"IP");
line 325 - while (fread(string,Data,sizeof(Data)))
line 333 - fclose(UserFile);

3 Errors:
[code=Errors]
(31 : error 008: must be a constant expression; assumed zero
(325) : error 035: argument type mismatch (argument 1)
(333) : error 017: undefined symbol "UserFile"
[/code]

please, help?
Reply
#14

sorry for the errors.

I didn\'t really understand why dini wasn\'t working so I just copied the way the saved info is loaded when you log in.

pawn Code:
public OnPlayerConnect(playerid)
{
    new string[256];
    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    PlayerInfo[playerid][pLevel] = 0;
    PlayerInfo[playerid][pKills] = 0;
    PlayerInfo[playerid][pDeaths] = 0;
    PlayerInfo[playerid][pCash] = 0;
    gPlayerAccount[playerid] = 0;
    gPlayerLogged[playerid] = 0;

    //Does Account Exist?
    format(string, sizeof(string), "Users/%s.ini", pName);
    if(fexist(string))
    {
      new File:PFILE=fopen(string, io_read);
      if(PFILE)
      {
            gPlayerAccount[playerid] = 1;
            //IP Checker
            new IP[20];
            new IP2[20];
            new key[256] , val[256];
            new Data[256];
           
            while (fread(PFILE,Data,sizeof(Data)))
            {
                key = ini_GetKey( Data );
                if( strcmp( key , "IP" , true ) == 0 ) { val = ini_GetValue( Data ); format(IP2,sizeof(IP2),"%s",val);}
                fclose(PFILE);
            }
            GetPlayerIp(playerid,IP,sizeof(IP));
            if(strcmp(IP,IP2,true)==0)
            {
                while (fread(PFILE,Data,sizeof(Data)))
                {
                    key = ini_GetKey( Data );
                    if( strcmp( key , "Level" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pLevel] = strval( val ); }
                    if( strcmp( key , "Kills" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pKills] = strval( val ); }
                    if( strcmp( key , "Deaths" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pDeaths] = strval( val ); }
                    if( strcmp( key , "Money" , true ) == 0 ) { val = ini_GetValue( Data ); PlayerInfo[playerid][pCash] = strval( val ); }
                }
                fclose(PFILE);
                gPlayerLogged[playerid] = 1;
                format(string, sizeof(string), "[SUCESS]%s, you have been automatically logged in.", pName);
                SendClientMessage(playerid, COLOR_GREEN, string);
            }
            else
            {
                format(string, sizeof(string), "[SERVER]Welcome back %s! Please login.", pName);
                SendClientMessage(playerid, COLOR_YELLOW, string);
                return 1;
            }
        }
    }
    else
    {
        format(string, sizeof(string),"[SERVER]Account %s isn\'t registered. Register using /register password",pName);
        SendClientMessage(playerid, COLOR_YELLOW,string);
        return 1;
    }
    return 1;
}
Reply
#15

Thanks, no errors. I\'ll test it now...
Reply
#16

"And when I login it sayies that player isn\'t registered, but if I login it logins perfectly... " Your contradicting yourself.
Reply
#17

Quote:
Originally Posted by v0nzz
"And when I login it sayies that player isn\'t registered, but if I login it logins perfectly... " Your contradicting yourself.
oh well it\'s fixed now.
Reply
#18

2 Bugs:

1. IP saves as 255.255.255.255
2. When I change player Level in *.ini file it doesn\'t save...

What should I do?
Reply
#19

Help me, please? any 1?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)