First alphabet of the password only
#1

Hello,

I have a problem with my register system.

If a person registers with the password "Happy" in scriptfiles his password is saved as "H" , only the first alphabet .... I dont know why ... Please look at the register command below


pawn Код:
new playername[MAX_PLAYER_NAME];
            new string[500];
            PlayerInfo[playerid][pPassword] = inputtext[playerid];
            GetPlayerName(playerid, playername, sizeof(playername));
            format(string, sizeof(string), "\\Accounts\\%s.ini", playername);
            new File: file = fopen(string, io_read);
            if (file)
            {
                new s[128],pName[24];
                GetPlayerName(playerid, pName, 24);
            format(s,sizeof(s),"Welcome, %s!\n\nThat name is allready used",pName);
                ShowPlayerDialog(playerid,60,1,"Register your account",s,"Register"," ");
                fclose(file);
                Kick(playerid);
                return 1;
            }
            new File:hFile;
            hFile = fopen(string, io_append);
            new var[32];
        format(var, 32, "%s\n", PlayerInfo[playerid][pPassword]);fwrite(hFile, var);
        format(var, 32, "Kills=%d\n",PlayerInfo[playerid][pKills]);fwrite(hFile, var);
        format(var, 32, "Deaths=%d\n",PlayerInfo[playerid][pDeaths]);fwrite(hFile, var);
        PlayerInfo[playerid][pCash] = GetPlayerMoney(playerid);
        format(var, 32, "Money=%d\n",PlayerInfo[playerid][pCash]);fwrite(hFile, var);
        format(var, 32, "Admin=%d\n",PlayerInfo[playerid][pAdmin]);fwrite(hFile, var);
            fclose(hFile);
            SendClientMessage(playerid, Green, "[Server]: Succesfully Registered!");
            OnPlayerLogin(playerid,inputtext);
            TutorialTime[playerid] = 1;

Thanks for helping
Reply
#2

Not sure but i think you have a warning on this line:

PlayerInfo[playerid][pPassword] = inputtext[playerid];

In the version of PAWN that SA-MP uses, you can't copy an array into another by using "=". Use another way, such as format.

When compiling, this line basically transform into:

PlayerInfo[playerid][pPassword][0] = inputtext[playerid][0]; hence why you have only the first letter saved in the file.
Reply
#3

pawn Код:
format(PlayerInfo[playerid][pPassword], 64, "%s", inputtext[playerid]);
Reply
#4

Quote:
Originally Posted by 0rb
Not sure but i think you have a warning on this line:

PlayerInfo[playerid][pPassword] = inputtext[playerid];

In the version of PAWN that SA-MP uses, you can't copy an array into another by using "=". Use another way, such as format.

When compiling, this line basically transform into:

PlayerInfo[playerid][pPassword][0] = inputtext[playerid][0]; hence why you have only the first letter saved in the file.
Alright let me test
Reply
#5

I tried to change that
pawn Код:
=
to
pawn Код:
==
but now it gives me a warning (previously it didnt)
Reply
#6

Quote:
Originally Posted by //exora
pawn Код:
format(PlayerInfo[playerid][pPassword], 64, "%s", inputtext[playerid]);
Reply
#7

Looks like it is fixed .. THanks ... I will inform you guys if i find a bug ... Thanks a lot
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)