Detect Error While Using Crashdetect Plugins
#1

ERRORS
Code:
[04:01:53] [debug] AMX backtrace:
[04:01:53] [debug] #0 000286c4 in public WantedColor () from 3GCNR.amx
[04:01:53] [debug] Run time error 4: "Array index out of bounds"
[04:01:53] [debug]  Accessing element at index 48 past array upper bound 47
I Think The Problem Is Here But How i Can Fix IT
Code:
public WantedColor()
{
    for (new i; i < MAX_PLAYERS; i++ && gTeam[i] == TEAM_CIV)
    {
        switch(GetPlayerWantedLevel(i))
        {
            case 0:
            {
                SetPlayerColor(i,COLOR_WHITE);
            }

            case 1 .. 3:
            {
                SetPlayerColor(i,yellow);
            }

            case 4 .. 10:
            {
                SetPlayerColor(i,red);
            }
        }
    }
}
Reply
#2

wait you are using the for loop incorrectly you are using condition with increment statement
use it like this
PHP Code:
 for (new iMAX_PLAYERS && gTeam[i] == TEAM_CIVi++ ) 
Reply
#3

Your Mean I Have To Replace This
Quote:

for (new i; i < MAX_PLAYERS; i++ && gTeam[i] == TEAM_CIV)

With
Quote:

for (new i; i < MAX_PLAYERS && gTeam[i] == TEAM_CIV; i++ )

Reply
#4

Quote:
Originally Posted by CarRamper
View Post
Your Mean I Have To Replace This

With
yeah.But its not necessarily fix your problem im still looking on your code for finding the index problem and is that full code in that function?
Reply
#5

yes it is a full code in that function i have replaced it but now getting new error
Code:
[04:23:07] [debug] Server crashed while executing 3GCNR.amx
[04:23:07] [debug] AMX backtrace:
[04:23:07] [debug] #0 native fwrite () from samp03svr
[04:23:07] [debug] #1 00027210 in public JoinsLog (1562740) from 3GCNR.amx
[04:23:07] [debug] #2 0004afa4 in public S@@_OnPlayerConnect (0, 33554432) from 3GCNR.amx
[04:23:07] [debug] #3 native CallLocalFunction () from samp03svr
[04:23:07] [debug] #4 0000ee4c in ?? (0) from 3GCNR.amx
[04:23:07] [debug] #5 00006538 in public SSCANF_OnPlayerConnect (0) from 3GCNR.amx
[04:23:07] [debug] #6 000009f4 in public OnPlayerConnect (0) from 3GCNR.amx
[04:23:07] [debug] Native backtrace:
[04:23:07] [debug] #0 e0adbe8b in _ZN10StackTraceC1EPv () from plugins/crashdetect.so
[04:23:07] [debug] #1 e0ad4bcf in _ZN11CrashDetect20PrintNativeBacktraceERSoPv () from plugins/crashdetect.so
[04:23:07] [debug] #2 e0ad5dbc in _ZN11CrashDetect20PrintNativeBacktraceEPv () from plugins/crashdetect.so
[04:23:07] [debug] #3 e0ad6226 in _ZN11CrashDetect11OnExceptionEPv () from plugins/crashdetect.so
[04:23:07] [debug] #4 e0adbadc in ?? () from plugins/crashdetect.so
[04:23:07] [debug] #5 e0e24410 in ?? ()
[04:23:07] [debug] #6 e0e24430 in ?? ()
[04:23:07] [debug] #7 e0b2e607 in gsignal () from /lib/i386-linux-gnu/libc.so.6
[04:23:07] [debug] #8 e0b31a33 in abort () from /lib/i386-linux-gnu/libc.so.6
[04:23:07] [debug] #9 e0b27757 in ?? () from /lib/i386-linux-gnu/libc.so.6
[04:23:07] [debug] #10 e0b27807 in ?? () from /lib/i386-linux-gnu/libc.so.6
[04:23:07] [debug] #11 0809b99c in ?? () from ./samp03svr
[04:23:07] [debug] #12 0809bdff in ?? () from ./samp03svr
[04:23:07] [debug] #13 080950e4 in ?? () from ./samp03svr
[04:23:07] [debug] #14 e0ad794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[04:23:07] [debug] #15 e0ada8f8 in ?? () from plugins/crashdetect.so
[04:23:07] [debug] #16 e0ade916 in amx_Exec () from plugins/crashdetect.so
[04:23:07] [debug] #17 e0ad6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[04:23:07] [debug] #18 e0ada659 in ?? () from plugins/crashdetect.so
[04:23:07] [debug] #19 080dfd62 in ?? () from ./samp03svr
[04:23:07] [debug] #20 080950e4 in ?? () from ./samp03svr
[04:23:07] [debug] #21 e0ad794b in _ZN11CrashDetect13DoAmxCallbackEiPiS0_ () from plugins/crashdetect.so
[04:23:07] [debug] #22 e0ada8f8 in ?? () from plugins/crashdetect.so
[04:23:07] [debug] #23 e0ade916 in amx_Exec () from plugins/crashdetect.so
[04:23:07] [debug] #24 e0ad6be6 in _ZN11CrashDetect9DoAmxExecEPii () from plugins/crashdetect.so
[04:23:07] [debug] #25 e0ada659 in ?? () from plugins/crashdetect.so
[04:23:07] [debug] #26 080a51c9 in ?? () from ./samp03svr
[04:23:07] [debug] #27 080d09ff in ?? () from ./samp03svr
[04:23:07] [debug] #28 080b5515 in ?? () from ./samp03svr
[04:23:07] [debug] #29 08071d38 in ?? () from ./samp03svr
[04:23:07] [debug] #30 08071e32 in ?? () from ./samp03svr
[04:23:07] [debug] #31 0807bc50 in ?? () from ./samp03svr
[04:23:07] [debug] #32 080aed3d in ?? () from ./samp03svr
[04:23:07] [debug] #33 080aef02 in ?? () from ./samp03svr
[04:23:07] [debug] #34 080aa13a in ?? () from ./samp03svr
[04:23:07] [debug] #35 e0b19a83 in __libc_start_main () from /lib/i386-linux-gnu/libc.so.6
What Part Of The Script I Shop Show U To Fix IT
Reply
#6

Invalid file handle crashes your server. Show the onplayerconnect callback
Reply
#7

Code:
public OnPlayerConnect(playerid)
{
    if(fexist(UserPath(playerid)))
{
    new string [ 240 ];
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), ""COL_WHITE"{0066FF}3G Cops And Robbers\n\n{0099FF}Player Login\n\n{FFFFFF}This nick,{0099FF}%s{FFFFFF},is Registered.\nIf this is not your account,please quit and change your nick.\n\nPlease {FFFF66}Enter Your Password {FFFFFF}To Login:", pName);
    ShowPlayerDialog(playerid, DIALOG_LOGIN, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Login", string, "Login", "Cancel");
}

    else
    {
      new string [ 300 ];
    INI_ParseFile(UserPath(playerid), "LoadUser_%s", .bExtra = true, .extra = playerid);

    new pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid, pName, sizeof(pName));

    format(string, sizeof(string), ""COL_WHITE"{0066FF}3G Cops And Robbers\n\n{999999}New Registration\n{FFFFFF}Nick:{0099FF}%s\n\n{FFFFFF}Do {FF0000}Not {FFFFFF}Register Multiple Accounts\n{FFFFFF}Do {FF0000}Not {FFFFFF}Use The Game Password That You Use Elsewhere\n\nPlease {FFFF66}Enter Your Password {FFFFFF}For Your Account:", pName);
    ShowPlayerDialog(playerid, DIALOG_REGISTER, DIALOG_STYLE_INPUT, ""COL_WHITE"{FFFFFF}CnR {FFFFFF}Registration", string, "Register", "Cancel");
}

        new ConnIP[16];
        GetPlayerIp(playerid,ConnIP,16);
        new compare_IP[16];
        new number_IP = 0;
        for(new i=0; i<MAX_PLAYERS; i++) {
                if(IsPlayerConnected(i)) {
                    GetPlayerIp(i,compare_IP,16);
                    if(!strcmp(compare_IP,ConnIP)) number_IP++;
                }
        }
        if((GetTickCount() - Join_Stamp) < Time_Limit)
            exceed=1;
        else
            exceed=0;
        if(strcmp(ban_s, ConnIP, false) == 0 && exceed == 1 )
        {
            Same_IP++;
            if(Same_IP > SAME_IP_CONNECT)
            {
                        Ban(playerid);
                        Same_IP=0;
            }
        }
        else
        {
                Same_IP=0;
        }
        if(number_IP > IP_LIMIT)
        Ban(playerid);
        GetStampIP(playerid);

    new joinMsg[128], name[MAX_PLAYER_NAME];
	GetPlayerName(playerid, name, sizeof(name));
	format(joinMsg, sizeof(joinMsg), "4[%d] 03*** %s has joined the server.", playerid, name);
	IRC_GroupSay(gGroupID, IRC_CHANNEL, joinMsg);

    TextDrawShowForPlayer(playerid, WantedLvlTxd[playerid]);
    TextDrawShowForPlayer(playerid, DrugTxd[playerid]);
	TextDrawShowForPlayer(playerid, DrugTxd[playerid]);

	LocationTD[playerid] = TextDrawCreate(8.000000, 430.000000, "_");
	TextDrawBackgroundColor(LocationTD[playerid], 255);
	TextDrawFont(LocationTD[playerid], 2);
	TextDrawLetterSize(LocationTD[playerid], 0.400000, 1.000000);
	TextDrawColor(LocationTD[playerid], -1);
	TextDrawSetOutline(LocationTD[playerid], 1);
	TextDrawSetProportional(LocationTD[playerid], 1);
	TextDrawUseBox(LocationTD[playerid], 1);
	TextDrawBoxColor(LocationTD[playerid], 80);
	TextDrawTextSize(LocationTD[playerid], 222.000000, 18.000000);

	XDeaths[playerid] = 0;
    LastDeath[playerid] = 0;
    IsRobbing[playerid] =0;
	IsBankRobbing[playerid] =0;
	IsApRobbing[playerid] =0;
	zoneupdates[playerid] =1;

	DescriptionText[playerid] = TextDrawCreate(320.0, 380.0, " ");
    TextDrawAlignment(DescriptionText[playerid], 2);
    TextDrawFont(DescriptionText[playerid], 1);
    TextDrawLetterSize(DescriptionText[playerid], 0.320000, 1.700000);
    TextDrawSetOutline(DescriptionText[playerid], 1);
    TextDrawHideForPlayer(playerid, DescriptionText[playerid]);

	new string[128], pName[MAX_PLAYER_NAME];
    GetPlayerName(playerid,pName,MAX_PLAYER_NAME);
    new plrIP[16];
    GetPlayerIp(playerid, plrIP, sizeof(plrIP));
    format(string,sizeof string,"%s has joined the server with the ip %s",pName,plrIP);
    JoinsLog(string);

	for( new i = 0; i <= 50; i ++ ) SendClientMessage(playerid,COLOR_WHITE, "" );
	SendClientMessage(playerid, COLOR_WHITE, "{FFFF66}Welcome to {33FF66}3G Cops&Robbers - Please {33FF66}register if you are new or login to retrieve your data!");
	SendClientMessage(playerid, COLOR_WHITE, "Be sure to check {FFFF66}/rules - and {FFFF66}/cmds - Type {FFFF66}/help if you need help about the server -");

	for(new i;i<sizeof(Coords);i++) SetPlayerMapIcon(playerid,i,Coords[i][X],Coords[i][Y],Coords[i][Z],Coords[i][ID],0,MAPICON_LOCAL);
	return 1;
}
Reply
#8

You should check whether the saving directory exists in your script files folder if it does not it will crash the server
and so you should make that directory.
Reply
#9

ok i have not made in i remember let i make it and see f it works
Reply
#10

Problem Fixed Thanks SREYAS
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)