Run Time Error 4
#1

Hi all as the title says I have run time error 4 in my script
Код:
Run time error 4: "Array index out of bounds"
[23/05/2015 14:42:32] [debug]  Accessing element at negative index -400
[23/05/2015 14:42:32] [debug] AMX backtrace:
[23/05/2015 14:42:32] [debug] #0 00007970 in ?? (0) from BulgEdition.amx
[23/05/2015 14:42:32] [debug] #1 0000b4f8 in public OnPlayerThings (0) from BulgEdition.amx
Код:
public OnPlayerThings(playerid) {
	new string[500], vehicleid = GetPlayerVehicleID(playerid), Float:vX, Float:vY, Float: vZ;
	GetVehiclePos(vehicleid, vX, vY, vZ);
	format(string, sizeof(string), "Speed: %s~n~Health: %d~n~Fuel: 100/100 l", GetVehicleSpeed(vehicleid, KMPH), GetVehicleHP(vehicleid));
	if(IsBoat(vehicleid) || IsPlane(vehicleid) || IsChopper(vehicleid)) {
		format(string, sizeof(string), "Speed: %s~n~Health: %d~n~Fuel: 100/100 l", GetVehicleSpeed(vehicleid, KNOTS), GetVehicleHP(vehicleid));
	}
	if(IsPlane(vehicleid) || IsChopper(vehicleid)) {
		format(string, sizeof(string), "Speed: %s~n~Health: %d~n~Fuel: 100/100 l~n~Height: %.0f", GetVehicleSpeed(vehicleid, KNOTS), GetVehicleHP(vehicleid), vZ);
	}
	TextDrawSetString(Draw[playerid][2], string);
	format(string, sizeof(string), "%s", GetVehicleName(vehicleid));
	TextDrawSetString(Draw[playerid][1], string);
	return 1;
}
where is the red color there is the problem. IDK what is
there is my stock for the vehicle names:
Код:
stock GetVehicleName(vehicleid) {
	new string[123];
	format(string, sizeof(string), "%s", VehicleNames[(GetVehicleModel(vehicleid) - 400)]);
	return string;
}
Please help. rep+
Reply


Messages In This Thread
Run Time Error 4 - by bgedition - 23.05.2015, 11:49
Re: Run Time Error 4 - by Konstantinos - 23.05.2015, 12:01
Re: Run Time Error 4 - by bgedition - 23.05.2015, 14:06
Re: Run Time Error 4 - by Konstantinos - 23.05.2015, 14:12
Re: Run Time Error 4 - by bgedition - 23.05.2015, 14:17
Re: Run Time Error 4 - by Konstantinos - 23.05.2015, 14:37
Re: Run Time Error 4 - by bgedition - 23.05.2015, 14:43
Re: Run Time Error 4 - by Konstantinos - 23.05.2015, 14:56

Forum Jump:


Users browsing this thread: 2 Guest(s)