Problem with Array - 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: Problem with Array (
/showthread.php?tid=629083)
Problem with Array -
nemanjasepa - 19.02.2017
[21:54:08] [debug] Run time error 4: "Array index out of bounds"
[21:54:08] [debug] Accessing element at index 2001 past array upper bound 1999
[21:54:08] [debug] AMX backtrace:
[21:54:08] [debug] #0 003f5540 in public OnVehicleStreamIn (0x0000003b, 0x00000000) from CC-RP.amx
What this mean? How I can fix that?
Here is OnVehicleStreamIn function
Код HTML:
public OnVehicleStreamIn(vehicleid, forplayerid)
{
if (CarInfo[VehicleOwned[vehicleid]][cLock] == 1)
{
SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 1);
}
else
{
SetVehicleParamsForPlayer(vehicleid, forplayerid, 0, 0);
return 1;
}
if(VehAlarm[vehicleid] == 1)
{
{
SetVehicleParamsForPlayer(vehicleid,forplayerid, 1, 0);
}
} else {
{
SetVehicleParamsForPlayer(vehicleid,forplayerid, 0, 0);
}
}
return 1;
}
Re: Problem with Array -
Pottus - 19.02.2017
Код:
if (CarInfo[VehicleOwned[vehicleid]][cLock] == 1)
What the fuck kind of indexing is this dude? You should never have to do that since your CarInfo array can never be larger than MAX_VEHICLES anyways not to mention your indexing is out to lunch apart from that issue.
Re: Problem with Array -
nemanjasepa - 19.02.2017
Quote:
Originally Posted by Pottus
Код:
if (CarInfo[VehicleOwned[vehicleid]][cLock] == 1)
What the fuck kind of indexing is this dude? You should never have to do that since your CarInfo array can never be larger than MAX_VEHICLES anyways not to mention your indexing is out to lunch apart from that issue.
|
Sorry, but how can I fix that ?
Re: Problem with Array -
Mencent - 20.02.2017
Hello.
The value in the first index of CarInfo is 2001 but you only can use 1999. Try to increase the value in the CarInfo declaration.
Re: Problem with Array -
nemanjasepa - 20.02.2017
I increased it to 2500, but now I get same error 2501 but you can use 2499
Re: Problem with Array -
Pottus - 20.02.2017
Quote:
Originally Posted by Mencent
Hello.
The value in the first index of CarInfo is 2001 but you only can use 1999. Try to increase the value in the CarInfo declaration.
|
That has absolutely nothing to do with it. There is no fixing this because the problem isn't here the problem is the design of the system.
Re: Problem with Array -
nemanjasepa - 20.02.2017
Quote:
Originally Posted by Pottus
That has absolutely nothing to do with it. There is no fixing this because the problem isn't here the problem is the design of the system.
|
What design? Should I delete this gamemode right now or what?
Re: Problem with Array -
nemanjasepa - 20.02.2017
Any solution for this?
Re: Problem with Array -
Mencent - 20.02.2017
Quote:
Originally Posted by Pottus
That has absolutely nothing to do with it. There is no fixing this because the problem isn't here the problem is the design of the system.
|
When you know the problem / solution, why you don't write it?
Re: Problem with Array -
Pottus - 20.02.2017
Quote:
Originally Posted by Mencent
When you know the problem / solution, why you don't write it?
|
I already said what to do this dude is just editing some shitty RP script he downloaded anyways and has no clue of what he is doing.