28.02.2012, 21:52
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
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?
Here is my LoadIRC call back
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
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);
}
}