Login Issue?
#1

pawn Код:
if(dialogid == dregister)
    {
        if(!response) return Kick(playerid);
        if(response)
        {
            if(!strlen(inputtext))
            {
                ShowPlayerDialog(playerid,dregister,DIALOG_STYLE_INPUT,"Register","Welcome! This account is not registered.\nEnter your own password to create a new account.\nPlease enter the password!","Register","Quit");
                return 1;
            }
            new plrIP[16];
            new string[128];
            new hashpass[129];
            WP_Hash(hashpass,sizeof(hashpass),inputtext);
            new INI:file = INI_Open(Path(playerid));
            INI_SetTag(file,"Player's Data");
            INI_WriteString(file,"Password",hashpass);
            INI_WriteInt(file,"AdminLevel",0);
            INI_WriteInt(file,"VIPLevel",0);
            INI_WriteInt(file,"Money",1500);
            INI_WriteInt(file,"Scores",0);
            INI_WriteInt(file,"Kills",0);
            INI_WriteInt(file,"Deaths",0);
            INI_WriteInt(file,"Faction",0);
            INI_WriteInt(file,"FactionRank",0);
            INI_WriteInt(file,"Skin",26);
            INI_WriteInt(file,"BankMoney",2500);
            INI_WriteInt(file,"Level",1);
            INI_WriteInt(file,"Experience",0);
            INI_WriteInt(file,"TutorialTaken",0);
            INI_WriteInt(file,"SpawnSelection",1);
            INI_Close(file);
            format(string, sizeof(string), "You have registered! [IP: %d] [PING: %d]", GetPlayerIp(playerid, plrIP, sizeof(plrIP)) , GetPlayerPing(playerid));
            SendClientMessage(playerid, 0x02D8FDFF, string);
            if(pInfo[playerid][Faction] >= 1)
            {
                format(string, sizeof(string), "Administrative Level: %d | Faction: %d (Rank %d) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
                SendClientMessage(playerid, 0x02D8FDFF, string);
                format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
                SendClientMessage(playerid, 0x02D8fDFF, string);
            }
            else
            {
                format(string, sizeof(string), "Administrative Level: %d | Faction: Civilian (N/A) | Helper: No | Money: %d", pInfo[playerid][Adminlevel], pInfo[playerid][Faction], pInfo[playerid][FactionRank], pInfo[playerid][Money]);
                SendClientMessage(playerid, 0x02D8FDFF, string);
                format(string, sizeof(string), "Bank Money: %d | Level: %d | Experience: %d | Address: None | Skin %d", pInfo[playerid][BankMoney], pInfo[playerid][Level], pInfo[playerid][Experience], pInfo[playerid][Skin]);
                SendClientMessage(playerid, 0x02D8fDFF, string);
            }
            return 1;
        }
    }
Basically my issue here above is that the script above for some reason is causing passwords not to save and an account file not being created, I am confused as of this point.
Reply
#2

The line
pawn Код:
if(!strlen(inputtext))
is wrong.
Strlen is to be used like:
pawn Код:
if(strlen(inputtext) < 2 ) // If string length is less than 2 chars.
 { Do something }
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)