Array index out of bounds when trying to read from dealership vehicles
#3

Quote:
Originally Posted by Konstantinos
Посмотреть сообщение
Posting what actually crashdetect printed would be useful otherwise it's just guessing.

For index -400, check VehicleName (model ID must be between 400-611 otherwise run time error 4).
For other index, see this:
pawn Код:
DealerShipData[dealershipid][dsName]
In case DealerShipData array is full and you are in range with the last point, dealershipid will be the last index + 1 which is actually out of bounds.

EDIT:

Yes, it was the name. DealerShipVehicle[i][Model] is 0 so either the vehicle does not exist or you forgot to assign the model ID.

Modify VehicleName and if the model ID is not between 400-611, do not retrieve the name from the array. Let it be NULL. You can also check in the loop, if the vehicle does not exist, skip to the next variable iterator (continue;).
Thanks, I fixed it by adding a check that looks if the model id is between 400 and 611.
Reply


Messages In This Thread
Array index out of bounds when trying to read from dealership vehicles - by Jimmy0wns - 09.06.2015, 19:31
Re: Array index out of bounds when trying to read from dealership vehicles - by Konstantinos - 09.06.2015, 19:39
Re: Array index out of bounds when trying to read from dealership vehicles - by Jimmy0wns - 10.06.2015, 13:44

Forum Jump:


Users browsing this thread: 1 Guest(s)