Server crashes
#1

I am running server and creating business inside game, but then on one moment server just shutdown, there are not showing any errors on logs, it just shut dows.

My business system http://pastebin.com/pT1c84fi
Reply
#2

Load crashdetect plugin and after server crashes, run time errors, it'll print to server log information related to it.

By the way, on the part you save the businesses, you don't check if the file handle is valid before using it in fwrite/fclose functions.
Reply
#3

I got this on my console
Quote:

samp03svr: amx/amxfile.c:222: fputs_cell: Assertion `fp!=((void *)0)' failed.

My Biz.ini file
Код:
1359.655883|-1756.173217|14.617500|180.491378|-25.737785|-188.250167|1003.546875|357.938140|1|17|Jack_Robertson|1|0|0|1|0|0|24-7|0|0|0|500|0|0|0
1928.669433|-1776.341430|13.546875|184.251510|6.318305|-31.746593|1003.549438|269.310638|2|10|Jack_Robertson|1|0|0|1|0|0|24-7|0|0|0|500|0|0|0
2105.487304|-1806.574218|13.554685|184.611679|372.610382|-133.520858|1001.492187|435.088989|3|5|Jack_Robertson|1|0|0|11|0|0|Well Stacked Pizza|0|0|0|500|0|0|0
2244.270996|-1665.534423|15.476560|181.501678|207.813980|-111.265129|1005.132812|352.101623|4|15|Jack_Robertson|1|0|0|5|0|0|Binco|0|0|0|500|0|0|0
2353.305664|-1485.194335|24.000000|0.000000|0.000000|0.000000|0.000000|463.022674|0|0|Jack_Robertson|1|0|0|8|0|0|Jack's Lotto|0|0|0|0|0|0|0
0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0|0||0|0|0|0|0|0||0|0|0|0|0|0|0
0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0.000000|0|0||0|0|0|0|0|0||0|0|0|0|0|0|0
Reply
#4

http://dracoblue.net/dev/amxamxfilec...-in-fputscell/

and:
pawn Код:
public SaveBiz()
{
    new File: file2 = fopen("Biz.ini", io_append);
    if (file2) // if valid handle
    {
        new idx, coordsstring[256];
        while (idx < sizeof(BizInfo))
        {
            format(coordsstring, sizeof(coordsstring), "%f|%f|%f|%f|%f|%f|%f|%f|%d|%d|%s|%d|%d|%d|%d|%d|%d|%s|%d|%d|%d|%d|%d|%d|%d\n",
            BizInfo[idx][bLocation_x],
            BizInfo[idx][bLocation_y],
            BizInfo[idx][bLocation_z],
            BizInfo[idx][bExitAngle],
            BizInfo[idx][bIntLocationx],
            BizInfo[idx][bIntLocationy],
            BizInfo[idx][bIntLocationz],
            BizInfo[idx][bEnterAngle],
            BizInfo[idx][bVirtualWorld],
            BizInfo[idx][bInterior],
            BizInfo[idx][bOwner],
            BizInfo[idx][bOwned],
            BizInfo[idx][bLocked],
            BizInfo[idx][bPrice],
            BizInfo[idx][bType],
            BizInfo[idx][bCameras],
            BizInfo[idx][bTill],
            BizInfo[idx][bName],
            BizInfo[idx][bFee],
            BizInfo[idx][bPInt],
            BizInfo[idx][bPVW],
            BizInfo[idx][bProducts],
            BizInfo[idx][bLottoTime],
            BizInfo[idx][bLottoJackpot],
            BizInfo[idx][bNewLottoJackpot]);
           
            idx++;
           
            fwrite(file2, coordsstring);
            fclose(file2);
        }
    }
}
Reply
#5

But can i use Biz.ini or maybe i need rename it Biz.cfg

I set all files CHMOD 777
Reply
#6

Now it don't save business when i do Maintenance but i have put it under.

Код:
forward SaveMaintenance();
public SaveMaintenance()
{
	foreach(Player, i)
	{
	    GameTextForPlayer(i, "Scheduled Maintenance..", 5000, 5);
	}

    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Carrier...", 1);
    SaveCarrier();
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Houses...", 1);
	SaveHouses();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Businesses...", 1);
	SaveBiz();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Dynamic Doors...", 1);
	SaveDynamicDoors();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Map Icons...", 1);
	SaveDynamicMapIcons();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Gates...", 1);
	SaveGates();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Event Points...", 1);
	SaveEventPoints();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Paintball Arenas...", 1);
	SavePaintballArenas();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Misc Stuff...", 1);
    SaveStuff();
    ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Office Elevator...", 1);
	SaveElevatorStuff();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Faction Pay...", 1);
	SaveThePay();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Server Stats...", 1);
	SaveServerStats();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Drug System...", 1);
	SaveDrugSystem();
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Force Saving Materials System...", 1);
	SaveMatsSystem();
	
	ABroadCast(COLOR_YELLOW, "{AA3333}Maintenance{FFFF00}: Streamer Plugin Shutting Down...", 1);
	DestroyAllDynamicObjects();
	DestroyAllDynamicPickups();
	DestroyAllDynamic3DTextLabels();
	DestroyAllDynamicCPs();
	DestroyAllDynamicMapIcons();
	DestroyAllDynamicRaceCPs();
	DestroyAllDynamicAreas();

	SetTimer("FinishMaintenance", 10000, false);

	return 1;
}
Reply
#7

Are you sure you did create the file which saves those bizs ?, Because it makes the server gets crashed.
Reply
#8

It sometimes cannot open a file successfully so you can read from/write to it. By checking if the file handle is valid, you prevent the server crash but still, it cannot save as the file failed to be opened.
Reply
#9

It might be if it had CHMOD 0644 so it wasnt writeable?
Reply
#10

Yes, permissions can cause this. Make sure that scriptfiles folder is both readable and writeable.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)