Command Restarts The Server
#1

Whenever I type /lands command it restarts my server but sometimes it works. Any idea about what the problem is?

Код:
CMD:lands(playerid, params[])
{
	new playername[MAX_PLAYER_NAME];
	GetPlayerName(playerid, playername, sizeof(playername));
	for(new x; x < MAX_LANDS; x++)
	{
		if(GangZoneCreate(playerid, LandInfo[x][landZone]))
		{
   			if(strcmp(playername, LandInfo[x][landOwner], true) == 0)
		    {
				editingLand[playerid] = x;
				break;
			}
			else
			{
			    editingLand[playerid] = -1;
			}
		}
	}
	ShowPlayerDialogEx(playerid, LANDSMAIN,DIALOG_STYLE_LIST, "Lands - Select an option", "Toggle Lands on Map\nBuild\nEdit a Building\nDestroy a Building\nBuy Land\nSell Land\nDestroy all objects", "Select", "Cancel");
	return 1;
}
Reply
#2

Use crashdetect plugin and try to crash it again.
It will give you a call backtrace - try to locate a line with error using it
Reply
#3

here it is

Код:
[10:49:27] [zcmd] [Usama Maxy]: /lands
[10:49:27] [debug] Server crashed while executing FGRP.amx
[10:49:27] [debug] AMX backtrace:
[10:49:27] [debug] #0 00000024 in public cmd_lands (0, 44325132) from FGRP.amx
[10:49:27] [debug] #1 native CallLocalFunction () from samp03svr
[10:49:27] [debug] #2 0000ad1c in public OnPlayerCommandText (0, 44325104) from FGRP.amx
[10:49:27] [debug] Native backtrace:
[10:49:27] [debug] #0 f743550b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[10:49:27] [debug] #1 f742e20f in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[10:49:27] [debug] #2 f742f3fc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[10:49:27] [debug] #3 f742f866 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[10:49:27] [debug] #4 f743515c in ?? () from plugins/crashdetect.so
[10:49:27] [debug] #5 f7786410 in ?? ()
[10:49:27] [debug] #6 f7437272 in amx_Exec () from plugins/crashdetect.so
[10:49:27] [debug] #7 f7430226 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[10:49:27] [debug] #8 f7433cd9 in ?? () from plugins/crashdetect.so
[10:49:27] [debug] #9 f72ec25c in ?? () from plugins/streamer.so
[10:49:27] [debug] #10 080dfd62 in ?? () from ./samp03svr
[10:49:27] [debug] #11 080950e4 in ?? () from ./samp03svr
[10:49:27] [debug] #12 f7430f7b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[10:49:27] [debug] #13 f7433f78 in ?? () from plugins/crashdetect.so
[10:49:27] [debug] #14 f7437f96 in amx_Exec () from plugins/crashdetect.so
[10:49:27] [debug] #15 f7430226 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[10:49:27] [debug] #16 f7433cd9 in ?? () from plugins/crashdetect.so
[10:49:27] [debug] #17 f72ec25c in ?? () from plugins/streamer.so
[10:49:27] [debug] #18 080a5632 in ?? () from ./samp03svr
[10:49:27] [debug] #19 080b1751 in ?? () from ./samp03svr
[10:49:27] [debug] #20 08071d38 in ?? () from ./samp03svr
[10:49:27] [debug] #21 08071e32 in ?? () from ./samp03svr
[10:49:27] [debug] #22 0807bc50 in ?? () from ./samp03svr
[10:49:27] [debug] #23 080aed3d in ?? () from ./samp03svr
[10:49:27] [debug] #24 080aef02 in ?? () from ./samp03svr
[10:49:27] [debug] #25 080aa13a in ?? () from ./samp03svr
[10:49:27] [debug] #26 f7471a83 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
 
----------
Loaded log file: "server_log.txt".
----------
 
SA-MP Dedicated Server
Any help please?
Reply
#4

Recompile your gamemode with -d3 and do it again. Your crash report must contain file and line number, for example:
Код:
[14:16:38] [debug] #0 0000002d in public cmd_lands (...) at \pawno\include\float.inc:109
Reply
#5

Quote:

Recompile your gamemode with -d3 and do it again. Your crash report must contain file and line number, for example:
Code:
[14:16:38] [debug] #0 0000002d in public cmd_lands (...) at \pawno\include\float.inc:109

Recompile your gamemode with -d3? sorry tell me what is -d3
Reply
#6

If you are using pawno, click Build -> Run Options and add "-d3" in the end of field "With these parameters:" (there must be a space before -)
Reply
#7

ok lemme test
Reply
#8

I get this now :

Код:
[15:26:41] [zcmd] [Usama Maxy]: /lands
[15:26:41] [debug] Server crashed while executing FGRP.amx
[15:26:41] [debug] AMX backtrace:
[15:26:41] [debug] #0 00000003 in public cmd_lands (3, 44330952) from FGRP.amx
[15:26:41] [debug] #1 native CallLocalFunction () from samp03svr
[15:26:41] [debug] #2 0000ad1c in public OnPlayerCommandText (3, 44330924) from FGRP.amx
Help me Please?
Reply
#9

Well, if you did everything correctly, I have no idea why there's no line number.

You can locate the line with error in another way - print something on each line of your command and then look into server log for the last printed value. Right after it you'll find error line

PHP код:
CMD:lands(playeridparams[])
{
    new 
playername[MAX_PLAYER_NAME];
        print( 
"BP1" );
    
GetPlayerName(playeridplayernamesizeof(playername));
        print( 
"BP2" );
    for(new 
xMAX_LANDSx++)
    {
        print( 
"BP3" );
        if(
GangZoneCreate(playeridLandInfo[x][landZone]))
        {
                        print( 
"BP4" );
               if(
strcmp(playernameLandInfo[x][landOwner], true) == 0)
            {
                                print( 
"BP5" );
                
editingLand[playerid] = x;
                                print( 
"BP6" );
                break;
            }
            else
            {
                            print( 
"BP7" );
                
editingLand[playerid] = -1;
                            print( 
"BP8" );
            }
        }
    }
        print( 
"BP9" );
    
ShowPlayerDialogEx(playeridLANDSMAIN,DIALOG_STYLE_LIST"Lands - Select an option""Toggle Lands on Map\nBuild\nEdit a Building\nDestroy a Building\nBuy Land\nSell Land\nDestroy all objects""Select""Cancel");
    return 
1;

For example, if your server crashed and the last message in server log was "BP4" that means that errot is on line
PHP код:
if(strcmp(playernameLandInfo[x][landOwner], true) == 0
which comes right after that print function.

Try to locate your error line in that way
Reply
#10

okay lemme see
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)