SA-MP Forums Archive
[Help] "Array index out of bounds" - 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] "Array index out of bounds" (/showthread.php?tid=445013)



[Help] "Array index out of bounds" - David (Sabljak) - 19.06.2013

Hello, i have problems on Car Ownership...

Код:
public OnPlayerEnterVehicle(playerid, vehicleid, ispassenger)
{
if(!ispassenger)
{
	if(VrstaVozilaInfo[vehicle[vehicleid]][Type] == 2)
	{
		if(haveveh[playerid] == 1 && TypeVehicleInfo[vehicleid][ID] == idvehicle[playerid]) { }
		else
		{
			if(VehicleInfo[idvehicle[playerid]][Locked] == 1)
			{
			new string[128];
			new Float:x, Float:y, Float:z;
			GetPlayerPos(playerid,x,y,z);
			SetPlayerPos(playerid, x, y, z+0.2);
			format(string,sizeof(string)," (Vehicle Locked!) {B5B5B5}Owner: %s", VozilaInfo[idvozila[playerid]][Vlasnik]);
			SCM(playerid, TCrvena, string);
			return 1;
			}
		}
	}
}
return 1;
}
Код:
[debug] Run time error 4: "Array index out of bounds"
[debug]  Accessing element at index 253 past array upper bound 199
[debug] AMX backtrace:
[debug] #0 0004a9d0 in ?? (0x00000000, 0x000000fd, 0x00000000) from -/-.amx
[debug] #1 00006080 in public OnPlayerEnterVehicle (0x00000000, 0x000000fd, 0x00000000)
I cant fix it...


Re: [Help] "Array index out of bounds" - MP2 - 19.06.2013

Ever heard of indentation? ,_,


Re: [Help] "Array index out of bounds" - David (Sabljak) - 19.06.2013

Fixed!


Re: [Help] "Array index out of bounds" - Vince - 19.06.2013

English, please! Many of us (and that includes me) can't be bothered to translate whatever "VrstaVozilaInfo" is.


Re: [Help] "Array index out of bounds" - David (Sabljak) - 19.06.2013

sry i forgot, i translated all didnt saw that XD

VrstaVozilaInfo means TpyeVehiclesInfo


Re: [Help] "Array index out of bounds" - David (Sabljak) - 19.06.2013

BUMP anyone?


Re: [Help] "Array index out of bounds" - Scenario - 19.06.2013

https://sampforum.blast.hk/showthread.php?tid=64144

Read the 7th bullet point.


Re: [Help] "Array index out of bounds" - MP2 - 20.06.2013

Quote:
Originally Posted by David (Sabljak)
Посмотреть сообщение
Fixed!
Quote:
Originally Posted by David (Sabljak)
Посмотреть сообщение
BUMP anyone?
wat.


Re: [Help] "Array index out of bounds" - David (Sabljak) - 20.06.2013

Quote:
Originally Posted by MP2
Посмотреть сообщение
wat.
"Ever heard of indentation? ,_, "

I fix that XD