Problem with saving files upon restarting server. (Filterscript.)
#1

So I have my register system, admin system, and my "Talent System" <--(Not relevant.) all in one filterscript. And the main game mode is totally seperate.

Anyways, the problem is; When I restart the filterscript (/rcon reloadfs) it removes everyone's stats. Admin, Vip, Score, Etc.

How would I go about saving these statistics? Is it possible? If not, why? What would you recommend? 0_o

Thank you.
Reply
#2

I recomend you to put it in gm... So you will not to relode all stats again.. because it could be it's rewriting them....
Reply
#3

Is there a way to avoid doing all of that...? I've invested hours of time into this script. It would take a arm and a leg to just copy and paste.
Reply
#4

Umm maybe.. Show please your onplayerlogin! And saving part OnPlayerConnect
Reply
#5

Under OnDialogResponse.
pawn Код:
switch( dialogid )
    {
        case DIALOG_REGISTER:
        {
            if (!response) return Kick(playerid);
            if(response)
            {
                if(!strlen(inputtext)) return ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"Registering...",""COL_RED"You have entered an invalid password.\n"COL_WHITE"Type your password below to register a new account.","Register","Quit");
                new INI:File = INI_Open(UserPath(playerid));
                INI_SetTag(File,"data");
                INI_WriteInt(File,"Password",udb_hash(inputtext));
                INI_WriteInt(File,"Cash",0);
                INI_WriteInt(File,"Admin",0);
                INI_WriteInt(File,"Vip",0);
                INI_WriteInt(File,"Kills",0);
                INI_WriteInt(File,"Deaths",0);
                INI_WriteInt(File,"Ban",0);
                INI_WriteInt(File,"Score",0);
                INI_WriteInt(File,"Talent",0);
                INI_Close(File);
Under OnPlayerConnect.
pawn Код:
if(fexist(UserPath(playerid)))
    {
        INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);
        ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_PASSWORD,""COL_WHITE"Login",""COL_WHITE"Type your password below to login.","Login","Quit");
    }
Reply
#6

And part of login too.. this looks good... and loading part will be needed too.. i had the same issue.. Just I checked everything if it's loading current stats and everything.. Then just was some mistakes.
Reply
#7

pawn Код:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    INI_Int("Password",PlayerInfo[playerid][pPass]);
    INI_Int("Cash",PlayerInfo[playerid][pCash]);
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    INI_Int("Vip",PlayerInfo[playerid][pVip]);
    INI_Int("Kills",PlayerInfo[playerid][pKills]);
    INI_Int("Deaths",PlayerInfo[playerid][pDeaths]);
    INI_Int("Ban",PlayerInfo[playerid][pBan]);
    INI_Int("Score",PlayerInfo[playerid][pScore]);
    INI_Int("Talent",PlayerInfo[playerid][pTalent]);
    return 1;
}
That's what I'm using to load their data.
Reply
#8

Btw did you tryed this:
OnGamemeModeInit
pawn Код:
SendRconCommand("reloadfs FSNAME");
OnGameModeExit
pawn Код:
SendRconCommand("unloadfs name");
It will automaticly load and unload fs... on server restart! + are you using timer on command /gmx?
Or you just restart server like closing it?
Reply
#9

i do /rcon reloadfs. And no, I don't have a timer.
Reply
#10

You know what, If I restart it via my mod cp - it works. So I guess I'll just stick to that.
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)