SA-MP Forums Archive
[Plugin] CrashDetect - 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: Plugin Development (https://sampforum.blast.hk/forumdisplay.php?fid=18)
+--- Thread: [Plugin] CrashDetect (/showthread.php?tid=262796)

Pages: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15


Re: crashdetect plugin - AndreT - 19.09.2011

Show the PingKick function to us.


Respuesta: crashdetect plugin - RcoN! - 19.09.2011

pawn Код:
public PingKick()
{
    if(ServerInfo[MaxPing] != 0)
    {
        PingPos++; if(PingPos > PING_MAX_EXCEEDS) PingPos = 0;

        for(new i=0; i<MAX_PLAYERS; i++)
        {
            Informacion[i][pPing][PingPos] = GetPlayerPing(i);

            if(GetPlayerPing(i) > ServerInfo[MaxPing])
            {
                if(Informacion[i][PingCount] == 0) Informacion[i][PingTime] = TimeStampxd();

                Informacion[i][PingCount]++;
                if(TimeStampxd() - Informacion[i][PingTime] > PING_TIMELIMIT)
                {
                    Informacion[i][PingTime] = TimeStampxd();
                    Informacion[i][PingCount] = 1;
                }
                else if(Informacion[i][PingCount] >= PING_MAX_EXCEEDS)
                {
                    new Sum, x, string[128];
                    while (x < PING_MAX_EXCEEDS) {
                        Sum += Informacion[i][pPing][x];
                        x++;
                    }
                    format(string,sizeof(string),"-Fantasilandia- kickeo a %s por exeder el ping maximo de %d de ping.", PlayerName2(i), ServerInfo[MaxPing] );
                    SendClientMessageToAll(red,string);
                    TogglePlayerControllable(i,false);
                    TextDrawShowForPlayer(i, FondoNegro);

                    new wea[500];
                    new PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(i, PlayerName, MAX_PLAYER_NAME);
                    new year,month,day; getdate(year, month, day);
                    new hour,minute,second; gettime(hour,minute,second);

                    format(wea,sizeof(wea),"{FFFFFF}Disculpa %s, tu has sido Kickeado del servidor!\
                    \n\n{FFFFFF}Admin: Fantasilandia\
                    \n{FFFFFF}Razon: Tienes %d de ping y lo maximo es %d.\
                    \n{FFFFFF}Fecha: %i/%i/%i Hora: %i:%i :%i\
                    \n\n{FFFFFF}* Porfavor cancela las descargas y vuelve a entrar."
,PlayerName,GetPlayerPing(i),ServerInfo[MaxPing], day,month,year, hour, minute, second);
                    ShowPlayerDialog(i, 8000, DIALOG_STYLE_MSGBOX, " *          ", wea, "OK", "");

                    for(new p = 0; p < MAX_PLAYERS; p++) {
                    if(IsPlayerConnected(p)) {
                    PlayerPlaySound(p,1140,0.0,0.0,0.0);}}
                    Kick(i);
                }
            }
        }
    }



Re: crashdetect plugin - Wyu - 19.09.2011

Compile your script with -d3 flag (see the first post for how) and it will show you exact location i.e. function name and line number


Re: Respuesta: crashdetect plugin - kurta999 - 19.09.2011

Try this.
I was same problem.

I changed 5th line.
pawn Код:
public PingKick()
{
    if(ServerInfo[MaxPing] != 0)
    {
           if(++PingPos >= PING_MAX_EXCEEDS) PingPos = 0;

        for(new i=0; i<MAX_PLAYERS; i++)
        {
            Informacion[i][pPing][PingPos] = GetPlayerPing(i);

            if(GetPlayerPing(i) > ServerInfo[MaxPing])
            {
                if(Informacion[i][PingCount] == 0) Informacion[i][PingTime] = TimeStampxd();

                Informacion[i][PingCount]++;
                if(TimeStampxd() - Informacion[i][PingTime] > PING_TIMELIMIT)
                {
                    Informacion[i][PingTime] = TimeStampxd();
                    Informacion[i][PingCount] = 1;
                }
                else if(Informacion[i][PingCount] >= PING_MAX_EXCEEDS)
                {
                    new Sum, x, string[128];
                    while (x < PING_MAX_EXCEEDS) {
                        Sum += Informacion[i][pPing][x];
                        x++;
                    }
                    format(string,sizeof(string),"-Fantasilandia- kickeo a %s por exeder el ping maximo de %d de ping.", PlayerName2(i), ServerInfo[MaxPing] );
                    SendClientMessageToAll(red,string);
                    TogglePlayerControllable(i,false);
                    TextDrawShowForPlayer(i, FondoNegro);

                    new wea[500];
                    new PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(i, PlayerName, MAX_PLAYER_NAME);
                    new year,month,day; getdate(year, month, day);
                    new hour,minute,second; gettime(hour,minute,second);

                    format(wea,sizeof(wea),"{FFFFFF}Disculpa %s, tu has sido Kickeado del servidor!\
                    \n\n{FFFFFF}Admin: Fantasilandia\
                    \n{FFFFFF}Razon: Tienes %d de ping y lo maximo es %d.\
                    \n{FFFFFF}Fecha: %i/%i/%i Hora: %i:%i :%i\
                    \n\n{FFFFFF}* Porfavor cancela las descargas y vuelve a entrar."
,PlayerName,GetPlayerPing(i),ServerInfo[MaxPing], day,month,year, hour, minute, second);
                    ShowPlayerDialog(i, 8000, DIALOG_STYLE_MSGBOX, " *          ", wea, "OK", "");

                    for(new p = 0; p < MAX_PLAYERS; p++) {
                    if(IsPlayerConnected(p)) {
                    PlayerPlaySound(p,1140,0.0,0.0,0.0);}}
                    Kick(i);
                }
            }
        }
    }



Respuesta: crashdetect plugin - RcoN! - 19.09.2011

the waring is ubicated in crashdetect.log Not in compile
Код:
Plugin succesfully loaded (version 3.1.3)
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".



Respuesta: Re: Respuesta: crashdetect plugin - RcoN! - 19.09.2011

Quote:
Originally Posted by kurta999
Посмотреть сообщение
Try this.
I was same problem.

I changed 5th line.
pawn Код:
public PingKick()
{
    if(ServerInfo[MaxPing] != 0)
    {
           if(++PingPos >= PING_MAX_EXCEEDS) PingPos = 0;

        for(new i=0; i<MAX_PLAYERS; i++)
        {
            Informacion[i][pPing][PingPos] = GetPlayerPing(i);

            if(GetPlayerPing(i) > ServerInfo[MaxPing])
            {
                if(Informacion[i][PingCount] == 0) Informacion[i][PingTime] = TimeStampxd();

                Informacion[i][PingCount]++;
                if(TimeStampxd() - Informacion[i][PingTime] > PING_TIMELIMIT)
                {
                    Informacion[i][PingTime] = TimeStampxd();
                    Informacion[i][PingCount] = 1;
                }
                else if(Informacion[i][PingCount] >= PING_MAX_EXCEEDS)
                {
                    new Sum, x, string[128];
                    while (x < PING_MAX_EXCEEDS) {
                        Sum += Informacion[i][pPing][x];
                        x++;
                    }
                    format(string,sizeof(string),"-Fantasilandia- kickeo a %s por exeder el ping maximo de %d de ping.", PlayerName2(i), ServerInfo[MaxPing] );
                    SendClientMessageToAll(red,string);
                    TogglePlayerControllable(i,false);
                    TextDrawShowForPlayer(i, FondoNegro);

                    new wea[500];
                    new PlayerName[MAX_PLAYER_NAME];
                    GetPlayerName(i, PlayerName, MAX_PLAYER_NAME);
                    new year,month,day; getdate(year, month, day);
                    new hour,minute,second; gettime(hour,minute,second);

                    format(wea,sizeof(wea),"{FFFFFF}Disculpa %s, tu has sido Kickeado del servidor!\
                    \n\n{FFFFFF}Admin: Fantasilandia\
                    \n{FFFFFF}Razon: Tienes %d de ping y lo maximo es %d.\
                    \n{FFFFFF}Fecha: %i/%i/%i Hora: %i:%i :%i\
                    \n\n{FFFFFF}* Porfavor cancela las descargas y vuelve a entrar."
,PlayerName,GetPlayerPing(i),ServerInfo[MaxPing], day,month,year, hour, minute, second);
                    ShowPlayerDialog(i, 8000, DIALOG_STYLE_MSGBOX, " *          ", wea, "OK", "");

                    for(new p = 0; p < MAX_PLAYERS; p++) {
                    if(IsPlayerConnected(p)) {
                    PlayerPlaySound(p,1140,0.0,0.0,0.0);}}
                    Kick(i);
                }
            }
        }
    }
thanks


Re: Respuesta: crashdetect plugin - Wyu - 19.09.2011

Quote:
Originally Posted by RcoN!
Посмотреть сообщение
the waring is ubicated in crashdetect.log Not in compile
Код:
Plugin succesfully loaded (version 3.1.3)
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of PingKick:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
I'm not talking about compile warnings, it will print the error lines in log


Re: crashdetect plugin - JernejL - 20.09.2011

Quote:

[00:36:15] []: During execution of CheckIRCCommand:
[00:36:15] []: Run time error 4: "Array index out of bounds"

Still getting these - no file info & no line info.. after a few moments the server crashed & crashdetect did not output any crash info (but i ran GDB so i have a full backtrace but it doesn't tell me what exactly crashed it)


Re: crashdetect plugin - cyber_punk - 20.09.2011

Quote:
Originally Posted by JernejL
Посмотреть сообщение
Still getting these - no file info & no line info.. after a few moments the server crashed & crashdetect did not output any crash info (but i ran GDB so i have a full backtrace but it doesn't tell me what exactly crashed it)
If your using Incognito's IRC plugin make sure your text input buffers are 512 characters as thats the max for irc setting it too small can result in a server crash I had that problem before.


Re: crashdetect plugin - JernejL - 20.09.2011

It's not incogito's irc plugin, it's a heavily improved & secured php "delvor bot" text based system without any plugin.


Re: crashdetect plugin - cyber_punk - 20.09.2011

Quote:
Originally Posted by JernejL
Посмотреть сообщение
It's not incogito's irc plugin, it's a heavily improved & secured php "delvor bot" text based system without any plugin.
Hmm.. I would assume the same rules would apply if there are any commands to input text from irc to in game, does the bot truncate the input text? Have you tried to send a very long text message through any of those commands to see if it crashes?


Respuesta: crashdetect plugin - RcoN! - 20.09.2011

Wahts is the error ?

Код:

Plugin succesfully loaded (version 3.1.3)
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
Exit
Plugin succesfully loaded (version 3.1.3)
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
Exit
Plugin succesfully loaded (version 3.1.3)
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
Plugin succesfully loaded (version 3.1.3)
Plugin unloaded
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
Plugin succesfully loaded (version 3.1.3)
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
gamemodes\FTS.amx: During execution of CDI_OnPlayerDeath:
gamemodes\FTS.amx: Run time error 4: "Array index out of bounds".
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
Plugin unloaded
Plugin succesfully loaded (version 3.1.3)
The error is include ChangeDeathInfo.inc
pawn Код:
#if defined _cdi_included
    #endinput
#endif
#define _cdi_included

#include <a_samp>

/*
native ChangeDeathInfo(playerid, killerid, reason, delay=30000);
native ResetDeathInfo(playerid);
*/


stock ChangeDeathInfo(playerid, killerid, reason, delay=30000)
{
    if(IsPlayerConnected(playerid))
    {
        SetPVarInt(playerid, "CDI_DeathReason", reason);
        SetPVarInt(playerid, "CDI_Killer", killerid);
        SetPVarInt(playerid, "CDI_Changed", GetTickCount());
        SetPVarInt(playerid, "CDI_ChangeDelay", delay);
        return 1;
    }
    return 0;
}

stock ResetDeathInfo(playerid)
{
    if(IsPlayerConnected(playerid))
    {
        SetPVarInt(playerid, "CDI_DeathReason", 255);
        SetPVarInt(playerid, "CDI_Killer", INVALID_PLAYER_ID);
        SetPVarInt(playerid, "CDI_Changed", GetTickCount());
        SetPVarInt(playerid, "CDI_ChangeDelay", 0);
        return 1;
    }
    return 0;
}

public OnPlayerSpawn(playerid)
{
    ResetDeathInfo(playerid);
    return CallLocalFunction("CDI_OnPlayerSpawn", "i", playerid);
}

#if defined _ALS_OnPlayerSpawn
    #undef OnPlayerSpawn
#else
    #define _ALS_OnPlayerSpawn
#endif
#define OnPlayerSpawn CDI_OnPlayerSpawn
forward CDI_OnPlayerSpawn(playerid);

public OnPlayerDeath(playerid, killerid, reason)
{
    if((GetPVarInt(playerid, "CDI_DeathReason") == 255 && !IsPlayerConnected(GetPVarInt(playerid, "CDI_Killer"))) || (GetTickCount() - GetPVarInt(playerid, "CDI_Changed")) > GetPVarInt(playerid, "CDI_ChangeDelay"))
        return CallLocalFunction("CDI_OnPlayerDeath", "iii", playerid, killerid, reason);
    return CallLocalFunction("CDI_OnPlayerDeath", "iii", playerid, GetPVarInt(playerid, "CDI_Killer"), GetPVarInt(playerid, "CDI_DeathReason"));
}

#if defined _ALS_OnPlayerDeath
    #undef OnPlayerDeath
#else
    #define _ALS_OnPlayerDeath
#endif
#define OnPlayerDeath CDI_OnPlayerDeath
forward CDI_OnPlayerDeath(playerid, killerid, reason);
wahts is the error ? please helpme


Re: Respuesta: crashdetect plugin - leong124 - 21.09.2011

Quote:
Originally Posted by JernejL
Посмотреть сообщение
Still getting these - no file info & no line info.. after a few moments the server crashed & crashdetect did not output any crash info (but i ran GDB so i have a full backtrace but it doesn't tell me what exactly crashed it)
I don't know if my problem is the same as yours, but my server will crash when there's run-time error, and no stack trace is shown.

Quote:
Originally Posted by RcoN!
Посмотреть сообщение
Wahts is the error ?

Код:
...
The error is include ChangeDeathInfo.inc
pawn Код:
//code
wahts is the error ? please helpme
The callback CDI_OnPlayerDeath is a hooked callback. You'd better search for your main script, which involves OnPlayerDeath.
Still, if you want to know where the exact line is, you can compile all your scripts with the -d2 flag. See the first post.


Re: Respuesta: crashdetect plugin - JernejL - 21.09.2011

Quote:
Originally Posted by leong124
Посмотреть сообщение
I don't know if my problem is the same as yours, but my server will crash when there's run-time error, and no stack trace is shown.
well you can get one via GDB and see where the server crashed with this .sh file:

Код:
echo 0 | gdb -batch-silent -ex "run" -ex "set logging overwrite on" -ex "set logging file gdb.bt" -ex "set logging on" -ex "set pagination off" -ex "handle SIG33 pass nostop noprint" -ex "echo backtrace:\n" -ex "backtrace full" -ex "echo \n\nregisters:\n" -ex "info registers" -ex "echo \n\ncurrent instructions:\n" -ex "x/16i \$pc" -ex "echo \n\nthreads backtrace:\n" -ex "thread apply all backtrace" -ex "set logging off" -ex "quit" samp03svr
date >> crash.log
cat gdb.bt >> crash.log
it won't tell you what part of script caused it, but knowing the part of server that crashed might help you debug it.


Re: crashdetect plugin - KillermanGR - 25.09.2011

Works like a charm. Thanks.


Re: crashdetect plugin - Slice - 29.09.2011

I get this in my crash log quite a lot, and no info after a crash:
Код:
Could not open file
Only that, no filename what so ever.


Re: crashdetect plugin - cyber_punk - 29.09.2011

Quote:
Originally Posted by Slice
Посмотреть сообщение
I get this in my crash log quite a lot, and no info after a crash:
Код:
Could not open file
Only that, no filename what so ever.

I have gotten that once it outputted...
Код:
Could not open file 
The server has crashed due to an unexpected error.
Maybe from a plugin or samp server itself? I have been curious about that seeing as it catches everything else.


AW: crashdetect plugin - Littl3j0hNy - 21.11.2011

Код:
Run time error 4: "Array index out of bounds"
Array max index is 211 but accessing an element at -400
Line:

Код:
modelid = GetVehicleModel(GetPlayerVehicleID(playerid))-400;
used for:

Код:
format(vehstr,sizeof(vehstr),"~w~~>~%s",VehicleInfo[modelid][vNAME]);
Another one:

Код:
During execution of OnPlayerCommandText():
Run time error 5: "Invalid memory access"
Additional information:
No details available
Why are there run time errors? Can someone help me?


Re: AW: crashdetect plugin - Walk_M4n - 22.11.2011

You're trying to get vehicleID, when player is not in vehicle.


AW: Re: AW: crashdetect plugin - Littl3j0hNy - 22.11.2011

Quote:
Originally Posted by Walk_M4n
Посмотреть сообщение
You're trying to get vehicleID, when player is not in vehicle.
But there is a check before

Код:
if(IsPlayerInAnyVehicle(playerid))
{
:/