New saving system and still not saving score/money
#1

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
Reply
#2

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.
Reply
#3

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
Reply
#4

Код:
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
Reply
#5

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
Reply
#6

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
Reply
#7

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;
}
Reply
#8

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.
Reply
#9

Try to check if you have the correct include
Reply
#10

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


Forum Jump:


Users browsing this thread: 1 Guest(s)