[14:31:02] [debug] Run time error 4: "Array index out of bounds"
[14:31:02] [debug] Accessing element at index 9 past array upper bound 8
[14:31:02] [debug] AMX backtrace:
[14:31:02] [debug] #0 0028b788 in ?? (1) from gm.amx
[14:31:02] [debug] #1 00064754 in ?? (1) from gm.amx
[14:31:02] [debug] #2 00017eb8 in public OnVehicleSpawn (1) from gm.amx
[14:31:02] [debug] #3 native SetVehicleToRespawn () from samp-server.exe
[14:31:02] [debug] #4 00057750 in ?? () from gm.amx
[14:31:02] [debug] #5 000175c0 in public RL_OnGameModeInit () from gm.amx
[14:31:02] [debug] #6 native CallLocalFunction () from samp-server.exe
[14:31:02] [debug] #7 0000ad6c in public zcmd_OnGameModeInit () from gm.amx
[14:31:02] [debug] #8 native CallLocalFunction () from samp-server.exe
[14:31:02] [debug] #9 00009250 in public SSCANF_OnGameModeInit () from gm.amx
[14:31:02] [debug] #10 000035b8 in public Itter_OnGameModeInit () from gm.amx
[14:31:02] [debug] #11 native CallLocalFunction () from samp-server.exe
[14:31:02] [debug] #12 00002874 in public ScriptInit_OnGameModeInit () from gm.amx
[14:31:02] [debug] #13 000017f8 in public OnGameModeInit () from gm.amx
public OnVehicleSpawn(vehicleid)
{
//new vehplatestr[128];
//format(vehplatestr, sizeof vehplatestr, "T:RP %i", vehicleid);
//SetVehicleNumberPlate(vehicleid, vehplatestr);
if(vehicleid != 509 && vehicleid != 481 && vehicleid != 510)
{
SetVehicleParamsEx(vehicleid, 0, 0, 0, 0, 0, 0, 0);
foreach(Player, i)
{
if(vehicleid == PlayerInfo[i][pVeh])
{
if(PlayerInfo[i][vLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0);
ChangeVehiclePaintjob(PlayerInfo[i][pVeh], PlayerInfo[i][vPJ]);
for(new x=0; x<14; i++)
{
AddVehicleComponent(PlayerInfo[i][pVeh], PlayerInfo[i][pVehMod][x]);
}
}
if(vehicleid == PlayerInfo[i][pVVeh])
{
if(PlayerInfo[i][vVLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0);
ChangeVehiclePaintjob(PlayerInfo[i][pVVeh], PlayerInfo[i][vVPJ]);
for(new x=0; x<14; i++)
{
AddVehicleComponent(PlayerInfo[i][pVVeh], PlayerInfo[i][pVVehMod][x]);
}
}
if(vehicleid == PlayerInfo[i][pBVeh])
{
if(PlayerInfo[i][vBLocked]) SetVehicleParamsEx(vehicleid, 0, 0, 0, 1, 0, 0, 0);
ChangeVehiclePaintjob(PlayerInfo[i][pBVeh], PlayerInfo[i][vBPJ]);
for(new x=0; x<14; i++)
{
AddVehicleComponent(PlayerInfo[i][pBVeh], PlayerInfo[i][pBVehMod][x]);
}
}
}
if(IsTruckerVehicle(vehicleid))
{
TruckPackages[vehicleid] = -1;
}
if(Siren[vehicleid])
{
Siren[vehicleid] = 0;
DestroyDynamicObject(SirenObject[vehicleid]);
DestroyDynamicObject(LightObject1[vehicleid]);
}
}
return 1;
}
public OnGameModeInit()
{
RL_OPUP = (funcidx("RL_OnPlayerUpdate") != -1);
RL_OPSC = (funcidx("RL_OnPlayerStateChange") != -1);
RL_OPKSC = (funcidx("RL_OnPlayerKeyStateChange") != -1);
RL_OPC = (funcidx("RL_OnPlayerConnect") != -1);
return (funcidx("RL_OnGameModeInit") != -1)?CallLocalFunction("RL_OnGameModeInit",""):1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit RL_OnGameModeInit
forward RL_OnGameModeInit();
public OnGameModeInit()
{
zcmd_g_HasOPCS = funcidx("OnPlayerCommandReceived") != -1;
zcmd_g_HasOPCE = funcidx("OnPlayerCommandPerformed") != -1;
if (funcidx("zcmd_OnGameModeInit") != -1)
{
return CallLocalFunction("zcmd_OnGameModeInit", "");
}
return 1;
}
#if defined _ALS_OnGameModeInit
#undef OnGameModeInit
#else
#define _ALS_OnGameModeInit
#endif
#define OnGameModeInit zcmd_OnGameModeInit
forward zcmd_OnGameModeInit();
public OnVehicleSpawn(vehicleid)
{
if (vehicleid < 0 || vehicleid == INVALID_VEHICLE_ID) return 1;
// Rest of code
return 1;
}
Add this to the top of OnVehicleSpawn:
PHP код:
|
[15:13:35] [debug] Run time error 4: "Array index out of bounds"
[15:13:35] [debug] Accessing element at index 9 past array upper bound 8
[15:13:35] [debug] AMX backtrace:
[15:13:35] [debug] #0 0028b7ec in ?? (1) from gm.amx
[15:13:35] [debug] #1 000647b8 in ?? (1) from gm.amx
[15:13:35] [debug] #2 00017eb8 in public OnVehicleSpawn (1) from gm.amx
[15:13:35] [debug] #3 native SetVehicleToRespawn () from samp-server.exe
[15:13:35] [debug] #4 00057750 in ?? () from gm.amx
[15:13:35] [debug] #5 000175c0 in public RL_OnGameModeInit () from gm.amx
[15:13:35] [debug] #6 native CallLocalFunction () from samp-server.exe
[15:13:35] [debug] #7 0000ad6c in public zcmd_OnGameModeInit () from gm.amx
[15:13:35] [debug] #8 native CallLocalFunction () from samp-server.exe
[15:13:35] [debug] #9 00009250 in public SSCANF_OnGameModeInit () from gm.amx
[15:13:35] [debug] #10 000035b8 in public Itter_OnGameModeInit () from gm.amx
[15:13:35] [debug] #11 native CallLocalFunction () from samp-server.exe
[15:13:35] [debug] #12 00002874 in public ScriptInit_OnGameModeInit () from gm.amx
[15:13:35] [debug] #13 000017f8 in public OnGameModeInit () from gm.amx
Compile with -d3 flag to get more information such as functions' name and lines.
From the looks of it, it seems the run time error is caused in IsTruckerVehicle function. |
Pawn compiler 3.2.3664 Copyright (c) 1997-2006, ITB CompuPhase
Header size: 25432 bytes
Code size: 3457228 bytes
Data size: 48760476 bytes
Stack/heap size: 16384 bytes; estimated max. usage: unknown, due to recursion
Total requirements:52259520 bytes
Since you've compiled with debug info just wait for the run time error to occur again and in the server log you'll get more information from crashdetect plugin. Post that part and the code from IsTruckerVehicle function.
|
[23:25:17] [debug] Run time error 4: "Array index out of bounds"
[23:25:17] [debug] Accessing element at index 9 past array upper bound 8
[23:25:17] [debug] AMX backtrace:
[23:25:17] [debug] #0 00334408 in IsTruckerVehicle (vehicleid=1) at C:\Users\Brooks\Desktop\test\gamemodes\gm.pwn:48371
[23:25:17] [debug] #1 0007e824 in ?? (... <1 argument>) at C:\Users\Brooks\Desktop\test\gamemodes\gm.pwn:7634
[23:25:17] [debug] #2 0001cbe0 in public OnVehicleSpawn (vehicleid=1) at C:\Users\Brooks\Desktop\test\pawno\include\YSI\y_hooks/impl.inc:798
[23:25:17] [debug] #3 native SetVehicleToRespawn () from samp-server.exe
[23:25:17] [debug] #4 0006e0b0 in ?? () at C:\Users\Brooks\Desktop\test\gamemodes\gm.pwn:6121
[23:25:17] [debug] #5 0001c1b8 in public RL_OnGameModeInit () at C:\Users\Brooks\Desktop\test\pawno\include\YSI\y_hooks/impl.inc:484
[23:25:17] [debug] #6 native CallLocalFunction () from samp-server.exe
[23:25:17] [debug] #7 0000cb30 in public zcmd_OnGameModeInit () at C:\Users\Brooks\Desktop\test\pawno\include\OPSP.inc:240
[23:25:17] [debug] #8 native CallLocalFunction () from samp-server.exe
[23:25:17] [debug] #9 0000aa18 in public SSCANF_OnGameModeInit () at C:\Users\Brooks\Desktop\test\pawno\include\zcmd.inc:68
[23:25:17] [debug] #10 000040bc in public Itter_OnGameModeInit () at C:\Users\Brooks\Desktop\test\pawno\include\sscanf2.inc:205
[23:25:17] [debug] #11 native CallLocalFunction () from samp-server.exe
[23:25:17] [debug] #12 00003008 in public ScriptInit_OnGameModeInit () at C:\Users\Brooks\Desktop\test\pawno\include\YSI\y_iterate.inc:791
[23:25:17] [debug] #13 00001c28 in public OnGameModeInit () at C:\Users\Brooks\Desktop\test\pawno\include\YSI\internal\..\y_scriptinit.inc:171
stock IsTruckerVehicle(vehicleid)
{
for(new i=0; i<10; i++)
{
if(vehicleid == JobInfo[JOB_TRUCKER][jCars][i]) return 1;
}
return 0;
}