Help me with this please.
#1

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]);
}
Reply
#2

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].
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)