Problem with Array
#1

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

Код:
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.
Reply
#3

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 ?
Reply
#4

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.
Reply
#5

I increased it to 2500, but now I get same error 2501 but you can use 2499
Reply
#6

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

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?
Reply
#8

Any solution for this?
Reply
#9

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?
Reply
#10

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


Forum Jump:


Users browsing this thread: 2 Guest(s)