SA-MP Forums Archive
New saving system and still not saving score/money - 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)
+--- Thread: New saving system and still not saving score/money (/showthread.php?tid=345770)



New saving system and still not saving score/money - Karl[NDZ] - 26.05.2012

I tried to make a new saving system but it still aint saving the money or score. Im pretty sure it have something to do on OnPlayerDisconnect because it dosen't save the score or money so here is the code for OnPlayerDisconnect:
pawn Код:
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",PlayerInfo[playerid][pScore]);
    INI_WriteInt(File,"Muted",PlayerInfo[playerid][pMuted]);
    INI_Close(File);
Also here is the guide I followed this time: https://sampforum.blast.hk/showthread.php?tid=273088


Re: New saving system and still not saving score/money - [FMJ]PowerSurge - 26.05.2012

Are you sure it's the saving that's a problem? Open a userfile and see if it's saved. If it is, it's your loading that should be focused on.


Re: New saving system and still not saving score/money - Karl[NDZ] - 26.05.2012

Quote:
Originally Posted by [FMJ]PowerSurge
Посмотреть сообщение
Are you sure it's the saving that's a problem? Open a userfile and see if it's saved. If it is, it's your loading that should be focused on.
It is't saving


Re: New saving system and still not saving score/money - jaami - 26.05.2012

Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(INI_Open(getINI(playerid))) {
    
    INI_WriteInt("Score",GetPlayerScore(playerid));
    INI_WriteInt("Cash",GetPlayerMoney(playerid));
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt("Pass",PlayerInfo[playerid][pPass]);
    INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);

    INI_Save();
    INI_Close();
    }
    return 1;
}
Put this code under OnPlayerDisconnect


Re: New saving system and still not saving score/money - Karl[NDZ] - 26.05.2012

Quote:
Originally Posted by jaami
Посмотреть сообщение
Код:
public OnPlayerDisconnect(playerid, reason)
{
    if(INI_Open(getINI(playerid))) {
    
    INI_WriteInt("Score",GetPlayerScore(playerid));
    INI_WriteInt("Cash",GetPlayerMoney(playerid));
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt("Pass",PlayerInfo[playerid][pPass]);
    INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);

    INI_Save();
    INI_Close();
    }
    return 1;
}
Put this code under OnPlayerDisconnect
Didn't work


Re: New saving system and still not saving score/money - Saad_ - 26.05.2012

Use Y_INI And follow Kush's tutorial step by step in the tutorial's section or Follow Kush's tutorial on SII if you want


Re: New saving system and still not saving score/money - cod5devious - 26.05.2012

try this

pawn Код:
forward OnPlayerSaveAcount(playerid);
pawn Код:
if(IsPlayerConnected(playerid)) {
        OnPlayerSaveAcount(playerid); // Make the onplayersaveaccount function
        IsLogged[playerid] = false;
        TextDrawHideForPlayer(playerid, Time);
        TextDrawHideForPlayer(playerid, Date);
    }
under
public OnPlayerDisconnect(playerid, reason)

then
pawn Код:
public OnPlayerSaveAcount(playerid)
{
    if(IsPlayerConnected(playerid)) {
    INI_WriteInt("Score",GetPlayerScore(playerid));
    INI_WriteInt("Cash",GetPlayerMoney(playerid));
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt("Pass",PlayerInfo[playerid][pPass]);
    INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);
    }
    return 1;
}



Re: New saving system and still not saving score/money - Karl[NDZ] - 26.05.2012

Quote:
Originally Posted by Saad_
Посмотреть сообщение
Use Y_INI And follow Kush's tutorial step by step in the tutorial's section or Follow Kush's tutorial on SII if you want
Quote:
Originally Posted by Karl[NDZ]
Посмотреть сообщение
Also here is the guide I followed this time: https://sampforum.blast.hk/showthread.php?tid=267808
Im using y_ini now.


Re: New saving system and still not saving score/money - jaami - 26.05.2012

Try to check if you have the correct include


Re: New saving system and still not saving score/money - Karl[NDZ] - 26.05.2012

Quote:
Originally Posted by cod5devious
Посмотреть сообщение
try this

pawn Код:
forward OnPlayerSaveAcount(playerid);
pawn Код:
if(IsPlayerConnected(playerid)) {
        OnPlayerSaveAcount(playerid); // Make the onplayersaveaccount function
        IsLogged[playerid] = false;
        TextDrawHideForPlayer(playerid, Time);
        TextDrawHideForPlayer(playerid, Date);
    }
under
public OnPlayerDisconnect(playerid, reason)

then
pawn Код:
public OnPlayerSaveAcount(playerid)
{
    if(IsPlayerConnected(playerid)) {
    INI_WriteInt("Score",GetPlayerScore(playerid));
    INI_WriteInt("Cash",GetPlayerMoney(playerid));
    INI_WriteInt("Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt("Pass",PlayerInfo[playerid][pPass]);
    INI_WriteInt("Kills",PlayerInfo[playerid][pKills]);
    INI_WriteInt("Deaths",PlayerInfo[playerid][pDeaths]);
    }
    return 1;
}
pawn Код:
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(421) : error 010: invalid function or declaration
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(423) : error 010: invalid function or declaration
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(542) : error 035: argument type mismatch (argument 1)
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(543) : error 035: argument type mismatch (argument 1)
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(544) : error 035: argument type mismatch (argument 1)
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(545) : error 035: argument type mismatch (argument 1)
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(546) : error 035: argument type mismatch (argument 1)
C:\Users\Meeee\Desktop\Night-Drifterz\gamemodes\nightdrifterz.pwn(547) : error 035: argument type mismatch (argument 1)