need help with account update automatic OnplayerUpdate
#1

need help with account update automatic OnplayerUpdate

I have this system on my gamemode and i want change it to Onplayerdisconnect, i test and it won"t work ...

Can help me pliz
Reply
#2

I'm not sure what do you mean with account update, but maybe posting the part of the script would be a good start.
Reply
#3

Quote:
Originally Posted by niCe
I'm not sure what do you mean with account update, but maybe posting the part of the script would be a good start.
pawn Code:
public OnPlayerUpdate(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        if(AccountInfo[playerid][aLogged] == 1)
        {
            new string3[128];
            new playername3[MAX_PLAYER_NAME];
            GetPlayerName(playerid, playername3, sizeof(playername3));
            format(string3, sizeof(string3), ACCOUNTS_FOLDER, playername3);
            new ip[20];
            GetPlayerIp(playerid,ip,sizeof(ip));
            new File: hFile = fopen(string3, io_write);
                        new PlayerScore, PlayerMoney;
                        PlayerMoney = GetPlayerMoney(playerid);
                        PlayerScore = GetPlayerScore(playerid);
                        AccountInfo[playerid][aScore] = PlayerScore;
                        AccountInfo[playerid][aMoney] = PlayerMoney;
            if (hFile)
            {
                new var[128];
                format(var, 128, "Donotlook=%s\n", AccountInfo[playerid][aPassword]);fwrite(hFile, var);
                format(var, 128, "Donotlook=%s\n",ip);fwrite(hFile, var);
                format(var, 128, "Donotlook=%i\n", AccountInfo[playerid][aLevel]);fwrite(hFile, var);
                format(var, 128, "Donotlook=%i\n", PlayerScore);fwrite(hFile, var);
                format(var, 128, "Donotlook=%d\n", PlayerMoney);fwrite(hFile, var);
                format(var, 128, "Donotlook=%i\n", airstrike[playerid]);fwrite(hFile, var);
                format(var, 128, "Donotlook=%i\n", LandMines[playerid]);fwrite(hFile, var);
                format(var, 128, "Donotlook=%i\n", Rank[playerid]);fwrite(hFile, var);
                fclose(hFile);
            }
        }
    }
    return 1;
}

Encrypt(string[])
{
    for(new x=0; x < strlen(string); x++)
    {
        string[x] += (3^x) * (x % 15);
        if(string[x] > (0xff))
        {
            string[x] -= 256;
        }
    }
}
pawn Code:
forward OnPlayerUpdate(playerid);
Reply
#4

Change 'OnPlayerUpdate' to 'OnPlayerUpdateX'

OnPlayerUpdate is already function being used by the SA-MP server.
Reply
#5

Quote:
Originally Posted by Joe Staff
Change 'OnPlayerUpdate' to 'OnPlayerUpdateX'

OnPlayerUpdate is already function being used by the SA-MP server.
I have changed all to OnplayerupdateX , i don't need it , i want save account don't on player update just on player disconnect
Reply
#6

I want to help, but i don't get what you are asking =.='
Reply
#7

He wants to put that code under OnPlayerDisconnect, but he says it doesn't work when he does it.
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)