Saving problem on GMX
#1

Ok so when I make a player an admin over this chat chanell they stay admin only until I restart the server, when I gmx all of the irc settings are reset, I have SaveIRC(); under On Game Mode Exit here is the code for that
It is making a channels.cfg file in my scriptfiles directory but instead of looking how it would if there was info being save it looks like this

Код:
|||0|0|||0|0|||0|0|||0|0|||0|0|||0|0|||0|0
Can someone help me out? Also have no idea what kind of file saving method this is using as I did not make this code, I just ported it to my game mode. Everything works it just don't save and I guess the server itself is what saves the info but when you GMX it forgets that info, can someone tell me how I would fix this?


pawn Код:
public SaveIRC()
{
    new File: file2;
    while (idx < sizeof(IRCInfo))
    {
        new coordsstring[256];
        format(coordsstring, sizeof(coordsstring), "%s|%s|%s|%d|%d\n",
        IRCInfo[idx][iAdmin],
        IRCInfo[idx][iMOTD],
        IRCInfo[idx][iPassword],
        IRCInfo[idx][iNeedPass],
        IRCInfo[idx][iLock]);
        if(idx == 0)
        {
            file2 = fopen("channels.cfg", io_write);
        }
        else
        {
            file2 = fopen("channels.cfg", io_append);
        }
        fwrite(file2, coordsstring);
        idx++;
        fclose(file2);
    }
    return 1;
}

Here is my LoadIRC call back

pawn Код:
public LoadIRC()
{
    new arrCoords[5][64];
    new strFromFile2[256];
    new File: file = fopen("channels.cfg", io_read);
    if(file)
    {

        while (idx < sizeof(IRCInfo))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, '|');
            strmid(IRCInfo[idx][iAdmin], arrCoords[0], 0, strlen(arrCoords[0]), 255);
            strmid(IRCInfo[idx][iMOTD], arrCoords[1], 0, strlen(arrCoords[1]), 255);
            strmid(IRCInfo[idx][iPassword], arrCoords[2], 0, strlen(arrCoords[2]), 255);
            IRCInfo[idx][iNeedPass] = strvalEx(arrCoords[3]);
            IRCInfo[idx][iLock] = strvalEx(arrCoords[4]);
            idx++;
        }
        fclose(file);
    }
}
Reply
#2

You need to put
pawn Код:
SaveIRC();
under
pawn Код:
OnGameModeExit()
Lemme know what happens.

Almost forgot, you also gotta do
pawn Код:
LoadIRC();
under
pawn Код:
OnGameModeInit()
Reply
#3

Quote:
Originally Posted by Walsh
Посмотреть сообщение
You need to put
pawn Код:
SaveIRC();
under
pawn Код:
OnGameModeExit
Lemme know what happens.
Silly me I forgot to mention that I had that in the first post, I also tried putting a timer on repeat every 10 seconds that did SaveIRC(); But that didn't work either so I removed it.
Reply
#4

Darn. D:
I never really learned file writing with anything other than y_ini. But what you can do is troubleshoot your problem by setting the IRC Info. Then shutting down your server not gmx'ing. From there you can check the IRC file again and pinpoint where your problem is. Whether it is in SaveIRC(); or LoadIRC();. I wish you luck man.
Reply
#5

It happens when I close my server as well, I don't think it ever saves it as I can be in game type /irc admins see my name then tab out go to script files the file is as I showed in my first post all 0's and ||| I been trying my best to figure this out for the best part of an hour and a half
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)