Account system don't work ...
#6

Quote:
Originally Posted by RealCop228
Посмотреть сообщение
Yeah and don't forget to SET their score using "SetPlayerScore", otherwise it would be a useless variable.
Quote:
Originally Posted by hanzen
Посмотреть сообщение
Under RegisterPlayer() change this:
pawn Код:
AccountInfo[playerid][aScore] = GetPlayerScore(playerid);
To:
pawn Код:
AccountInfo[playerid][aScore] = 0; // change to default starting score
So i have changed
pawn Код:
AccountInfo[playerid][aScore] = GetPlayerScore(playerid);
TO
pawn Код:
AccountInfo[playerid][aScore] = 0;
AND ADDED

pawn Код:
SetPlayerScore(playerid, 0);
TO THE FC

So here is the result:
pawn Код:
public RegisterPlayer(playerid, password[])
{
    if(IsPlayerConnected(playerid))
    {
        new name[MAX_PLAYER_NAME], str[128];
        GetPlayerName(playerid, name, sizeof name);
        format(str, sizeof str, "%s.ini", name);
        new File:account = fopen(str, io_write);
        if (account)
        {
            SetPlayerScore(playerid, 0)
            strmid(AccountInfo[playerid][aPassword], password, 0, strlen(password), 128);
            AccountInfo[playerid][aCash] = GetPlayerMoney(playerid);
            AccountInfo[playerid][aScore] = 0;
            GetPlayerPos(playerid, AccountInfo[playerid][aX], AccountInfo[playerid][aY], AccountInfo[playerid][aZ]);
            GetPlayerFacingAngle(playerid, AccountInfo[playerid][aA]);
            new file[128];
            {
                format(file, sizeof file, "Password: %s\n", AccountInfo[playerid][aPassword]);
                {   fwrite(account, file); }
                format(file, sizeof file, "Cash: %d\n",AccountInfo[playerid][aCash]);
                {   fwrite(account, file); }
                format(file, sizeof file, "Score: %d\n", AccountInfo[playerid][aScore]);
                {   fwrite(account, file); }
                format(file, sizeof file, "X: %f\n",AccountInfo[playerid][aX]);
                {   fwrite(account, file); }
                format(file, sizeof file, "Y: %f\n",AccountInfo[playerid][aY]);
                {   fwrite(account, file); }
                format(file, sizeof file, "Z: %f\n",AccountInfo[playerid][aZ]);
                {   fwrite(account, file); }
                format(file, sizeof file, "Angle: %f\n",AccountInfo[playerid][aA]);
                {   fwrite(account, file); }
            }
            fclose(account);
            SendClientMessage(playerid, 0x21DD00FF, "You have successfully registered an account. You may now /login.");
        }
    }
    return 1;
}
Is that OK ? Im going to test it ... ^^
Reply


Messages In This Thread
Account system don't work ... - by Michael@Belgium - 05.01.2011, 14:42
Re: Account system don't work ... - by hanzen - 05.01.2011, 14:45
Re: Account system don't work ... - by Michael@Belgium - 05.01.2011, 15:13
Re: Account system don't work ... - by hanzen - 05.01.2011, 15:22
Re: Account system don't work ... - by Scenario - 05.01.2011, 15:23
Re: Account system don't work ... - by Michael@Belgium - 05.01.2011, 19:00
Re: Account system don't work ... - by Scenario - 05.01.2011, 19:53
Re: Account system don't work ... - by Michael@Belgium - 05.01.2011, 20:02

Forum Jump:


Users browsing this thread: 1 Guest(s)