Help me with this please. - 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: Help me with this please. (
/showthread.php?tid=632523)
Help me with this please. -
LazzyBoy - 15.04.2017
i just rerunned my gamemode and got those errors from crashdetector
Код:
[debug] #0 000aa5f4 in public ModCar (carid=29) at ./assets/no.pwn:13217
[debug] Run time error 4: "Array index out of bounds"
[debug] Attempted to read/write array element at index 65535 in array of size 50000
[debug] AMX backtrace:
[debug] #0 000aa5f4 in public ModCar (carid=27) at ./assets/no.pwn:13217
Код:
function:ModCar(carid)
{
new vehicleid = FindVehicleID(carid);
for(new c = 0; c < CAR_COMPONENTS; c++)
{
if(VehicleInfo[vehicleid][vComponents][c] > 0)
{
AddVehicleComponent(carid, VehicleInfo[vehicleid][vComponents][c]);
}
}
ChangeVehiclePaintjob(carid, VehicleInfo[vehicleid][vPaintJob]);
}
Re: Help me with this please. -
Toroi - 15.04.2017
Add a check before the loop and terminate the function if vehicleid is equal to
INVALID_VEHICLE_ID.
What i think it's happening is that the function
FindVehicleID(carid) returns the value of
INVALID_VEHICLE_ID if it couldn't find the vehicle and you're trying to fit
INVALID_VEHICLE_ID inside
VehicleInfo[your array with a limit lower than
INVALID_VEHICLE_ID].