SA-MP Forums Archive
need help with account update automatic OnplayerUpdate - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: need help with account update automatic OnplayerUpdate (/showthread.php?tid=138025)



need help with account update automatic OnplayerUpdate - Noredine - 31.03.2010

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


Re: need help with account update automatic OnplayerUpdate - niCe - 31.03.2010

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


Re: need help with account update automatic OnplayerUpdate - Noredine - 31.03.2010

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);



Re: need help with account update automatic OnplayerUpdate - Joe Staff - 31.03.2010

Change 'OnPlayerUpdate' to 'OnPlayerUpdateX'

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


Re: need help with account update automatic OnplayerUpdate - Noredine - 31.03.2010

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


Re: need help with account update automatic OnplayerUpdate - VirSpectorX - 31.03.2010

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


Re: need help with account update automatic OnplayerUpdate - biltong - 31.03.2010

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