problem with load player stats
#4

Where do you load the data? In OnPlayerConnect? This is the part I need to help you. Also I suggest moving saving data to separate function like:

pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    SavePlayerData(playerid);
    return 1;
}

public OnPlayerDisconnect(playerid, reason)
{
    SavePlayerData(playerid);
    return 1;
}

stock SavePlayerData(playerid) {
    GetPlayerWeaponData(playerid,1,PlayerInfo[playerid][pW1],PlayerInfo[playerid][pWam1]);
    GetPlayerWeaponData(playerid,2,PlayerInfo[playerid][pW2],PlayerInfo[playerid][pWam2]);
    GetPlayerWeaponData(playerid,3,PlayerInfo[playerid][pW3],PlayerInfo[playerid][pWam3]);
    GetPlayerWeaponData(playerid,4,PlayerInfo[playerid][pW4],PlayerInfo[playerid][pWam4]);
    GetPlayerWeaponData(playerid,5,PlayerInfo[playerid][pW5],PlayerInfo[playerid][pWam5]);
    GetPlayerWeaponData(playerid,6,PlayerInfo[playerid][pW6],PlayerInfo[playerid][pWam6]);
    GetPlayerWeaponData(playerid,7,PlayerInfo[playerid][pW7],PlayerInfo[playerid][pWam7]);
    GetPlayerWeaponData(playerid,8,PlayerInfo[playerid][pW8],PlayerInfo[playerid][pWam8]);
    new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    INI_WriteInt(File,"Cash",GetPlayerMoney(playerid));
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt(File,"Deaths",PlayerInfo[playerid][pDeaths]);
    INI_WriteInt(File,"Score", GetPlayerScore(playerid));
    INI_WriteInt(File,"WEAPON1",PlayerInfo[playerid][pW1]);
    INI_WriteInt(File,"WEAPONAMMU1",PlayerInfo[playerid][pWam1]);
    INI_WriteInt(File,"WEAPON2",PlayerInfo[playerid][pW2]);
    INI_WriteInt(File,"WEAPONAMMU2",PlayerInfo[playerid][pWam2]);
    INI_WriteInt(File,"WEAPON3",PlayerInfo[playerid][pW3]);
    INI_WriteInt(File,"WEAPONAMMU3",PlayerInfo[playerid][pWam3]);
    INI_WriteInt(File,"WEAPON4",PlayerInfo[playerid][pW4]);
    INI_WriteInt(File,"WEAPONAMMU4",PlayerInfo[playerid][pWam4]);
    INI_WriteInt(File,"WEAPON5",PlayerInfo[playerid][pW5]);
    INI_WriteInt(File,"WEAPONAMMU5",PlayerInfo[playerid][pWam5]);
    INI_WriteInt(File,"WEAPON6",PlayerInfo[playerid][pW6]);
    INI_WriteInt(File,"WEAPONAMMU6",PlayerInfo[playerid][pWam6]);
    INI_WriteInt(File,"WEAPON7",PlayerInfo[playerid][pW7]);
    INI_WriteInt(File,"WEAPONAMMU7",PlayerInfo[playerid][pWam7]);
    INI_WriteInt(File,"WEAPON8",PlayerInfo[playerid][pW8]);
    INI_WriteInt(File,"WEAPONAMMU8",PlayerInfo[playerid][pWam8]);
    INI_Close(File);
}
Reply


Messages In This Thread
problem with load player stats - by nton - 01.08.2012, 09:40
Re: problem with load player stats - by Misiur - 01.08.2012, 10:00
Re: problem with load player stats - by nton - 01.08.2012, 10:23
Re: problem with load player stats - by Misiur - 01.08.2012, 10:32
Re: problem with load player stats - by nton - 01.08.2012, 11:15
Re: problem with load player stats - by Misiur - 01.08.2012, 11:31
Re: problem with load player stats - by nton - 01.08.2012, 11:50
Re: problem with load player stats - by nton - 01.08.2012, 12:11

Forum Jump:


Users browsing this thread: 2 Guest(s)