sa-mp.exe doesn't finish
#1

Alright. I've got a really old script (0.2) and I recompiled it to 0.3x(newest version). I had five warnings when compiling , but it still compiled. I've updated everything and I start sa-mp.exe and it leads me to some point and randomly shuts down , nothing displayed in the server_log about it. Everything loads in the beginning.
Reply
#2

It's recommended to be compiled with 0 errors/warnings.

Load crashdetect plugin and start the server again. Post what it printed.
Reply
#3

[04:07:37] [debug] Server crashed while executing ERP.amx
[04:07:37] [debug] AMX backtrace:
[04:07:37] [debug] #0 native fclose () [004056c0] from samp-server.exe
[04:07:37] [debug] #1 00023a94 in public LoadfCars () from ERP.amx
[04:07:37] [debug] #2 000297b4 in public OnGameModeInit () from ERP.amx
[04:07:37] [debug] Native backtrace:
[04:07:37] [debug] #0 0049316b in ?? () from C:\Users\Administrator\Desktop\Cross RP\samp-server.exe
[04:07:37] [debug] #1 004056cd in ?? () from C:\Users\Administrator\Desktop\Cross RP\samp-server.exe
[04:07:37] [debug] #2 6f3b5f2a in ?? () from C:\Users\Administrator\Desktop\Cross RP\plugins\crashdetect.DLL
[04:07:37] [debug] #3 6f3b822e in ?? () from C:\Users\Administrator\Desktop\Cross RP\plugins\crashdetect.DLL
[04:07:37] [debug] #4 6f3aff6f in ?? () from C:\Users\Administrator\Desktop\Cross RP\plugins\crashdetect.DLL
[04:07:37] [debug] #5 6f3b5f7a in ?? () from C:\Users\Administrator\Desktop\Cross RP\plugins\crashdetect.DLL
[04:07:37] [debug] #6 0046e1f4 in ?? () from C:\Users\Administrator\Desktop\Cross RP\samp-server.exe
[04:07:37] [debug] #7 65646f6d in ?? () from C:\Users\Administrator\Desktop\Cross RP\samp-server.exe
[04:07:37] [debug] #8 52452f73 in ?? () from C:\Users\Administrator\Desktop\Cross RP\samp-server.exe
[04:07:37] [debug] #9 6d612e50 in ?? () from C:\Users\Administrator\Desktop\Cross RP\samp-server.exe
Reply
#4

You don't check whether it opened the file correctly beforing writing to/closing the file in LoadfCars.

Take a look at the example of the SA-MP Wiki: https://sampwiki.blast.hk/wiki/Fclose

Check if the handle is valid or if you cannot do it, post LoadfCars.
Reply
#5

Код:
public LoadfCars()
{
new arrCoords[9][64];
new strFromFile2[256];
new File: file = fopen("/settings/factioncars.cfg", io_read);
if (file)
{
new idx;
while (idx < sizeof(FactionCar))
{
fread(file, strFromFile2);
split(strFromFile2, arrCoords, ',');
FactionCar[idx][fcMod] = strval(arrCoords[0]);
FactionCar[idx][fcParkx] = floatstr(arrCoords[1]);
FactionCar[idx][fcParky] = floatstr(arrCoords[2]);
FactionCar[idx][fcParkz] = floatstr(arrCoords[3]);
FactionCar[idx][fcParkr] = floatstr(arrCoords[4]);
FactionCar[idx][fcCol1] = strval(arrCoords[5]);
FactionCar[idx][fcCol2] = strval(arrCoords[6]);
FactionCar[idx][fcFaction] = strval(arrCoords[7]);
FactionCar[idx][fcEngine] = strval(arrCoords[8]);
idx++;
}
}
fclose(file);
return 1;
}
Reply
#6

pawn Код:
public LoadfCars()
{
    new arrCoords[9][20];
    new strFromFile2[128];
    new File: file = fopen("/settings/factioncars.cfg", io_read);
    if (file)
    {
        new idx;
        while (idx < sizeof(FactionCar))
        {
            fread(file, strFromFile2);
            split(strFromFile2, arrCoords, ',');
            FactionCar[idx][fcMod] = strval(arrCoords[0]);
            FactionCar[idx][fcParkx] = floatstr(arrCoords[1]);
            FactionCar[idx][fcParky] = floatstr(arrCoords[2]);
            FactionCar[idx][fcParkz] = floatstr(arrCoords[3]);
            FactionCar[idx][fcParkr] = floatstr(arrCoords[4]);
            FactionCar[idx][fcCol1] = strval(arrCoords[5]);
            FactionCar[idx][fcCol2] = strval(arrCoords[6]);
            FactionCar[idx][fcFaction] = strval(arrCoords[7]);
            FactionCar[idx][fcEngine] = strval(arrCoords[8]);
            idx++;
        }
        fclose(file);
    }
    return 1;
}
fclose was out of the: if (file) check; hence it crashed. It should've been inside that check. Also 256 is too much, make it lower. Same for the float's string.
Reply
#7

Thank you. It works now. Wanted to ask also about this.
Код:
[04:36:47] [debug] Run time error 4: "Array index out of bounds"
[04:36:47] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:47] [debug] AMX backtrace:
[04:36:47] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:48] [debug] Run time error 4: "Array index out of bounds"
[04:36:48] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:48] [debug] AMX backtrace:
[04:36:48] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:49] [debug] Run time error 4: "Array index out of bounds"
[04:36:49] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:49] [debug] AMX backtrace:
[04:36:49] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:50] [debug] Run time error 4: "Array index out of bounds"
[04:36:50] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:50] [debug] AMX backtrace:
[04:36:50] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:52] [debug] Run time error 4: "Array index out of bounds"
[04:36:52] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:52] [debug] AMX backtrace:
[04:36:52] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:53] [debug] Run time error 4: "Array index out of bounds"
[04:36:53] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:53] [debug] AMX backtrace:
[04:36:53] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:54] [debug] Run time error 4: "Array index out of bounds"
[04:36:54] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:54] [debug] AMX backtrace:
[04:36:54] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:55] [debug] Run time error 4: "Array index out of bounds"
[04:36:55] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:55] [debug] AMX backtrace:
[04:36:55] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:56] [debug] Run time error 4: "Array index out of bounds"
[04:36:56] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:56] [debug] AMX backtrace:
[04:36:56] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:57] [debug] Run time error 4: "Array index out of bounds"
[04:36:57] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:57] [debug] AMX backtrace:
[04:36:57] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:36:58] [debug] Run time error 4: "Array index out of bounds"
[04:36:58] [debug]  Accessing element at index 500 past array upper bound 499
[04:36:58] [debug] AMX backtrace:
[04:36:58] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:00] [debug] Run time error 4: "Array index out of bounds"
[04:37:00] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:00] [debug] AMX backtrace:
[04:37:00] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:01] [debug] Run time error 4: "Array index out of bounds"
[04:37:01] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:01] [debug] AMX backtrace:
[04:37:01] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:02] [debug] Run time error 4: "Array index out of bounds"
[04:37:02] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:02] [debug] AMX backtrace:
[04:37:02] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:03] [debug] Run time error 4: "Array index out of bounds"
[04:37:03] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:03] [debug] AMX backtrace:
[04:37:03] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:04] [debug] Run time error 4: "Array index out of bounds"
[04:37:04] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:04] [debug] AMX backtrace:
[04:37:04] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:05] [debug] Run time error 4: "Array index out of bounds"
[04:37:05] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:05] [debug] AMX backtrace:
[04:37:05] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:07] [debug] Run time error 4: "Array index out of bounds"
[04:37:07] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:07] [debug] AMX backtrace:
[04:37:07] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:08] [debug] Run time error 4: "Array index out of bounds"
[04:37:08] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:08] [debug] AMX backtrace:
[04:37:08] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:09] [debug] Run time error 4: "Array index out of bounds"
[04:37:09] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:09] [debug] AMX backtrace:
[04:37:09] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:10] [debug] Run time error 4: "Array index out of bounds"
[04:37:10] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:10] [debug] AMX backtrace:
[04:37:10] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:11] [debug] Run time error 4: "Array index out of bounds"
[04:37:11] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:11] [debug] AMX backtrace:
[04:37:11] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:12] [debug] Run time error 4: "Array index out of bounds"
[04:37:12] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:12] [debug] AMX backtrace:
[04:37:12] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:13] [debug] Run time error 4: "Array index out of bounds"
[04:37:13] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:13] [debug] AMX backtrace:
[04:37:13] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:15] [debug] Run time error 4: "Array index out of bounds"
[04:37:15] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:15] [debug] AMX backtrace:
[04:37:15] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:16] [debug] Run time error 4: "Array index out of bounds"
[04:37:16] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:16] [debug] AMX backtrace:
[04:37:16] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:17] [debug] Run time error 4: "Array index out of bounds"
[04:37:17] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:17] [debug] AMX backtrace:
[04:37:17] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:18] [debug] Run time error 4: "Array index out of bounds"
[04:37:18] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:18] [debug] AMX backtrace:
[04:37:18] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:19] [debug] Run time error 4: "Array index out of bounds"
[04:37:19] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:19] [debug] AMX backtrace:
[04:37:19] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:20] [debug] Run time error 4: "Array index out of bounds"
[04:37:20] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:20] [debug] AMX backtrace:
[04:37:20] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:21] [debug] Run time error 4: "Array index out of bounds"
[04:37:21] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:21] [debug] AMX backtrace:
[04:37:21] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
[04:37:23] [debug] Run time error 4: "Array index out of bounds"
[04:37:23] [debug]  Accessing element at index 500 past array upper bound 499
[04:37:23] [debug] AMX backtrace:
[04:37:23] [debug] #0 00102b14 in public TaxiFare () from ERP.amx
Reply
#8

It exceeds the bounds. MAX_PLAYERS was defined as 500 so the valid indexes are 0-499.

In a loop (most likely) in TaxiFare, you may have a check like that (an example):
pawn Код:
for(new i = 0; i <= MAX_PLAYERS; i++)
// It's been executed 501 times.
That's incorrect and it should be:
pawn Код:
for(new i = 0; i < MAX_PLAYERS; i++)
// It's been executed 500 times - just like MAX_PLAYERS.
Reply
#9

Konstantinos, right after fixing this problem, we appeared to have some sort of a problem with the register.

Код:
[14:58:03] [debug] Server crashed while executing CCRP.amx
[14:58:03] [debug] AMX backtrace:
[14:58:03] [debug] #0 native fwrite () [004056e0] from samp-server.exe
[14:58:03] [debug] #1 0009b898 in public OnPlayerCommandText (0x00000000, 0x0028766c) from CCRP.amx
[14:58:03] [debug] Native backtrace:
[14:58:03] [debug] #0 77cb7732 in ?? () from C:\Windows\SYSTEM32\ntdll.dll
[14:58:03] [debug] #1 00492980 in ?? () from D:\Downloads\PAWNO\Cross RP\samp-server.exe
[14:58:03] [debug] #2 0040531e in ?? () from D:\Downloads\PAWNO\Cross RP\samp-server.exe
Here's what we get, any clue what causes this?
Reply
#10

Hm, fwrite which was used in OnPlayerCommandText crashed the server but the rest are unknown. You may need to compile with debug info your scripts and it might give the line that caused the crash: https://github.com/Zeex/samp-plugin-...ith-debug-info

By the way, may you're aware of - if any of the commands was executed in that time? That would help as well.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)