SA-MP Forums Archive
Server Crashing - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Server Crashing (/showthread.php?tid=456155)



Server Crashing - Zloobe - 04.08.2013

So i have this issue that a random time when playing on my GM, it suddenly shuts down the server with no errors what so ever. The Console just pops down and i need to restart it :S Please do anyone know how to fix this issue?

EDIT #1
This is a code i saw that i get when the server shuts down?
Код:
[20:40:20] [debug] Server crashed while executing NRG.amx
[20:40:20] [debug] AMX backtrace:
[20:40:20] [debug] #0 native fread () [004057a0] from samp-server.exe
[20:40:20] [debug] #1 001ea2b0 in ?? () from NRG.amx
[20:40:20] [debug] #2 004972d0 in public ServerHeartbeat () from NRG.amx
[20:40:20] [debug] System backtrace:
[20:40:21] [debug] #0 00492860 in ?? () from C:\Users\Kevin\Desktop\NRG\samp-server.exe
[20:40:21] [debug] #1 00492e90 in ?? () from C:\Users\Kevin\Desktop\NRG\samp-server.exe
[20:40:21] [debug] #2 00404f44 in ?? () from C:\Users\Kevin\Desktop\NRG\samp-server.exe



Re: Server Crashing - DrDoom151 - 04.08.2013

It must be something in your script, try narrowing it down.
What did you do when it crashed? Is it after a certain amount of time? Is it after it loads vehicles?

Ask yourself these questions, unless you narrow it down it'll be hard to help


Re: Server Crashing - Zloobe - 04.08.2013

Quote:
Originally Posted by DrDoom151
Посмотреть сообщение
It must be something in your script, try narrowing it down.
What did you do when it crashed? Is it after a certain amount of time? Is it after it loads vehicles?

Ask yourself these questions, unless you narrow it down it'll be hard to help
Its after nearly One hour of playing on the gamemode :/


Re: Server Crashing - DrDoom151 - 04.08.2013

What does the ServerHeartbeat function do? That seems to be crashing it.


Re: Server Crashing - Zloobe - 04.08.2013

Quote:
Originally Posted by DrDoom151
Посмотреть сообщение
What does the ServerHeartbeat function do? That seems to be crashing it.
Honestly i have no idea as my friend got this script from someone and he sended it to me :/


Re: Server Crashing - DrDoom151 - 04.08.2013

Try thoroughly reading it to understand what it does exactly, because that's probably where your problem's located


Re: Server Crashing - Zloobe - 04.08.2013

I think it must be this coding as it crashes when reciving the paycheck...
Код:
		if(playerTabbed[i] == 0) {
			switch(PlayerInfo[i][pLevel]) {
				case 0 .. 2: PlayerInfo[i][pPayCheck] += 1;
				case 3 .. 4: PlayerInfo[i][pPayCheck] += 2;
				case 5 .. 6: PlayerInfo[i][pPayCheck] += 3;
				case 7 .. 8: PlayerInfo[i][pPayCheck] += 4;
				case 9 .. 10: PlayerInfo[i][pPayCheck] += 5;
				case 11 .. 12: PlayerInfo[i][pPayCheck] += 6;
				case 13 .. 14: PlayerInfo[i][pPayCheck] += 7;
				case 15 .. 16: PlayerInfo[i][pPayCheck] += 8;
				case 17 .. 18: PlayerInfo[i][pPayCheck] += 9;
				case 19 .. 20: PlayerInfo[i][pPayCheck] += 10;
				default: PlayerInfo[i][pPayCheck] += 11;
			}
			if(++PlayerInfo[i][pConnectSeconds] >= 3600) {
				PayDay(i);
			}
		}



Re: Server Crashing - DrDoom151 - 04.08.2013

Good job finding out what exactly causes it!
What you could do is place a few prints to find the exact spot. Here you go:
pawn Код:
if(playerTabbed[i] == 0) {
    print("1");
    switch(PlayerInfo[i][pLevel]) {
        print("2");
        case 0 .. 2: PlayerInfo[i][pPayCheck] += 1;
        case 3 .. 4: PlayerInfo[i][pPayCheck] += 2;
        case 5 .. 6: PlayerInfo[i][pPayCheck] += 3;
        case 7 .. 8: PlayerInfo[i][pPayCheck] += 4;
        case 9 .. 10: PlayerInfo[i][pPayCheck] += 5;
        case 11 .. 12: PlayerInfo[i][pPayCheck] += 6;
        case 13 .. 14: PlayerInfo[i][pPayCheck] += 7;
        case 15 .. 16: PlayerInfo[i][pPayCheck] += 8;
        case 17 .. 18: PlayerInfo[i][pPayCheck] += 9;
        case 19 .. 20: PlayerInfo[i][pPayCheck] += 10;
        print("3");
        default: PlayerInfo[i][pPayCheck] += 11;
        print("4");
    }
    if(++PlayerInfo[i][pConnectSeconds] >= 3600) {
        print("5");
        PayDay(i);
        print("6");
    }
    print("7");
}



Re: Server Crashing - Zloobe - 04.08.2013

Now i got some errors after adding the prints
Код:
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100607) : error 002: only a single statement (or expression) can follow each "case"
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100607) : warning 215: expression has no effect
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100608) : error 014: invalid statement; not in switch
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100608) : warning 215: expression has no effect
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100608) : error 001: expected token: ";", but found ".."
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100608) : error 029: invalid expression, assumed zero
C:\Users\Kevin\Desktop\NRG\gamemodes\NRG.pwn(100608) : fatal error 107: too many error messages on one line

Compilation aborted.Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


5 Errors.



Re: Server Crashing - DrDoom151 - 04.08.2013

I take it 100607 and 100608 are print 3? Just remove the ones it won't allow.