SA-MP Forums Archive
Servers is Crashing [Crash detect included] - 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: Servers is Crashing [Crash detect included] (/showthread.php?tid=525703)



Servers is Crashing [Crash detect included] - Kenway - 13.07.2014

This is the eror:
Код:
[15:35:30] [debug] Run time error 4: "Array index out of bounds"
[15:35:30] [debug]  Accessing element at index 65535 past array upper bound 500
[15:35:30] [debug] AMX backtrace:
[15:35:30] [debug] #0 0007f03c in public S@@_OnPlayerDeath (playerid=0, killerid=65535, reason=54) at D:\Players\Developent\UGRP.pwn:10617
[15:35:30] [death] Cristiano_El_Caprio died 54
[15:35:37] [debug] Server crashed while executing UGRP.amx
[15:35:37] [debug] AMX backtrace:
[15:35:37] [debug] #0 ???????? in ?? ()
[15:35:37] [debug] System backtrace:



Re: Servers is Crashing [Crash detect included] - Jacob756 - 13.07.2014

show us/me your GM line 65545

to do this click edit on the top left corner > goto ? line number


Re: Servers is Crashing [Crash detect included] - Kenway - 13.07.2014

Quote:
Originally Posted by Jacob756
Посмотреть сообщение
show us/me your GM line 65545

to do this click edit on the top left corner > goto ? line number
This
pawn Код:
else if(strcmp(choice,"pot",true) == 0)
        {
            if(IsPlayerConnected(giveplayerid))
            {
                if (ProxDetectorS(8.0, playerid, giveplayerid))
                {
                    format(string, sizeof(string), "* You have taken away %s's pot.", GetPlayerNameEx(giveplayerid));
                    SendClientMessageEx(playerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "* Officer %s has taken away your pot.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                    SendClientMessageEx(giveplayerid, COLOR_LIGHTBLUE, string);
                    format(string, sizeof(string), "* Officer %s has taken away %s's pot.", GetPlayerNameEx(playerid), GetPlayerNameEx(giveplayerid));
                    ProxDetector(30.0, playerid, string, COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE,COLOR_PURPLE);
                    PlayerInfo[giveplayerid][pPot] = 0;
                }
                else
                {
                    SendClientMessageEx(playerid, COLOR_GREY, "That player isn't near you.");
                    return 1;
                }
            }
            else
            {
                SendClientMessageEx(playerid, COLOR_GREY, "Invalid player specified.");
                return 1;
            }
        }



Re: Servers is Crashing [Crash detect included] - Konstantinos - 13.07.2014

Ignore the above comment.

The problem is in OnPlayerDeath callback. The killerid is INVALID_PLAYER_ID (65535) so that means that the player died himself and you used "killerid" in array(s) which is out of bounds (that index). The line is 10617 but you can fix it easier by doing this:
pawn Код:
public OnPlayerDeath(playerid, killerid, reason)
{
    if (killerid != INVALID_PLAYER_ID)
    {
        // code..
        // here you can use "killerid" in arrays and to send them messages/gametext, give money/score or whatever
    }
    return 1;
}



Re: Servers is Crashing [Crash detect included] - Kenway - 14.07.2014

Now its doing only this:

Quote:

[16:09:10] [debug] Server crashed while executing UGRP.amx
[16:09:10] [debug] AMX backtrace:
[16:09:10] [debug] #0 ?? in ?? ()
[16:09:10] [debug] System backtrace:




Re: Servers is Crashing [Crash detect included] - Kenway - 14.07.2014

help?


Re: Servers is Crashing [Crash detect included] - Kenway - 15.07.2014

helpo


Re: Servers is Crashing [Crash detect included] - Konstantinos - 15.07.2014

Compile your scripts with debug info and make sure the version of crashdetect plugin is the latest one (4.13.1). After another server crash, it should also print the last function was called and probably the line too.


Re: Servers is Crashing [Crash detect included] - Kenway - 15.07.2014

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Compile your scripts with debug info and make sure the version of crashdetect plugin is the latest one (4.13.1). After another server crash, it should also print the last function was called and probably the line too.
Its with -d3