Server Crashes
#1

When I start the server and after about 30 minutes the server crashes.
and the Crashdetect plugin detects errors like this:

Код:
[06:19:35] [debug] #1 00166074 in SaveFamilies () at f:\SAMPSERVER\IRPS Baru\samp03\gamemodes\b.pwn:23389
[06:19:35] [debug] #2 00678ae4 in public @yT_300000_SaveAccountsUpdate () at f:\SAMPSERVER\IRPS Baru\samp03\gamemodes\b.pwn:102046
PHP код:
SaveFamilies()
{
    new 
idx 1;
    new 
Filefile2;
    while (
idx sizeof(FamilyInfo))
    {
        new 
coordsstring[512];
        
format(coordsstringsizeof(coordsstring), "%d|%s|%s|%s|%d|%d|%d|%f|%f|%f|%d|%d|%d|%s|%s|%s|%s|%s|%s|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d|%d\n",
        
FamilyInfo[idx][FamilyTaken],
        
FamilyInfo[idx][FamilyName],
        
FamilyInfo[idx][FamilyMOTD],
        
FamilyInfo[idx][FamilyLeader],
        
FamilyInfo[idx][FamilyBank],
        
FamilyInfo[idx][FamilyCash],
        
FamilyInfo[idx][FamilyUSafe],
        
FamilyInfo[idx][FamilySafe][0],
        
FamilyInfo[idx][FamilySafe][1],
        
FamilyInfo[idx][FamilySafe][2],
        
FamilyInfo[idx][FamilyPot],
        
FamilyInfo[idx][FamilyCrack],
        
FamilyInfo[idx][FamilyMats],
        
FamilyInfo[idx][FamilyRank1],
        
FamilyInfo[idx][FamilyRank2],
        
FamilyInfo[idx][FamilyRank3],
        
FamilyInfo[idx][FamilyRank4],
        
FamilyInfo[idx][FamilyRank5],
        
FamilyInfo[idx][FamilyRank6],
        
FamilyInfo[idx][FamilyMembers],
        
FamilyInfo[idx][FamilyMaxSkins],
        
FamilyInfo[idx][FamilySkins][0],
        
FamilyInfo[idx][FamilySkins][1],
        
FamilyInfo[idx][FamilySkins][2],
        
FamilyInfo[idx][FamilySkins][3],
        
FamilyInfo[idx][FamilySkins][4],
        
FamilyInfo[idx][FamilySkins][5],
        
FamilyInfo[idx][FamilySkins][6],
        
FamilyInfo[idx][FamilySkins][7],
        
FamilyInfo[idx][FamilyColor],
        
FamilyInfo[idx][FamilyTurfTokens],
        
FamilyInfo[idx][FamilyGuns][0],
        
FamilyInfo[idx][FamilyGuns][1],
        
FamilyInfo[idx][FamilyGuns][2],
        
FamilyInfo[idx][FamilyGuns][3],
        
FamilyInfo[idx][FamilyGuns][4],
        
FamilyInfo[idx][FamilyGuns][5],
        
FamilyInfo[idx][FamilyGuns][6],
        
FamilyInfo[idx][FamilyGuns][7],
        
FamilyInfo[idx][FamilyGuns][8],
        
FamilyInfo[idx][FamilyGuns][9]);
        if(
idx == 1)
        {
            
file2 fopen("families.cfg"io_write);
        }
        else
        {
            
file2 fopen("families.cfg"io_append);
        }
        
fwrite(file2coordsstring); // ERROR LINE: 23389
        
idx++;
    }
    
fclose(file2);
    if(
GMOFF == 1)
    {
        print(
"Semua family telah disimpan");
    }
    return 
1;

AND

PHP код:
Timer:SaveAccountsUpdate[300000]() //ERROR LINE: 102046
{
    new 
playerip[32];
    foreach(
Playeri)
    {
        
PlayerInfo[i][pInt] = GetPlayerInterior(i);
        
PlayerInfo[i][pVW] = GetPlayerVirtualWorld(i);
        
PlayerInfo[i][pChar] = PlayerInfo[i][pModel];
        
GetPlayerIp(iplayeripsizeof(playerip));
        
format(PlayerInfo[i][pIP], 32"%s"playerip);
        
GetPlayerPos(iPlayerInfo[i][pPos_x], PlayerInfo[i][pPos_y], PlayerInfo[i][pPos_z]);
        
GetPlayerFacingAngle(iPlayerInfo[i][pPos_r]);
        
OnPlayerStatsUpdate(i);
    }
    
SaveFamilies();
    
SaveFamiliesHQ();

Reply
#2

Before writing something into the file you must check its status because it might not be opened; and after working with the file you must close it to avoid some crashes.

Example:
pawn Код:
new File:fp = fopen("file.ini", io_readwrite);
if (!fp) {
     return 0;
}
fclose(fp);
fopen function
Reply
#3

Exactly what function does "Timer: SaveAccountsUpdate [300000] ()"?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)