Run time error 4: "Array index out of bounds"
#1

Guys this is my problem.

Quote:

[18:57:20] [debug] Run time error 4: "Array index out of bounds"
[18:57:20] [debug] Attempted to read/write array element at negative index -1
[18:57:20] [debug] AMX backtrace:
[18:57:20] [debug] #0 000360a8 in public CloseGate (0, -1, 1150833603, -999882465, 1110108525, 1056964608, 1036818528, -1028325393, -102067987 from rrp.amx

Quote:

forward CloseGate(gateid, linkid, Float:fX, Float:fY, Float:fZ, Floatpeed, Float:fRotX, Float:fRotY, Float:fRotZ);
public CloseGate(gateid, linkid, Float:fX, Float:fY, Float:fZ, Floatpeed, Float:fRotX, Float:fRotY, Float:fRotZ)
{
new id = -1;

if (GateData[gateid][gateExists] && GateData[gateid][gateOpened])
{
MoveDynamicObject(GateData[gateid][gateObject], fX, fY, fZ, speed, fRotX, fRotY, fRotZ);

if ((id = GetGateByID(linkid)) != -1)
MoveDynamicObject(GateData[id][gateObject], GateData[id][gatePos][0], GateData[id][gatePos][1], GateData[id][gatePos][2], speed, GateData[id][gatePos][3], GateData[id][gatePos][4], GateData[id][gatePos][5]);

GateData[id][gateOpened] = 0;
return 1;
}
return 0;
}

Reply
#2

This is might be the problem if you excluding this from the condition.
PHP код:
GateData[id][gateOpened] = 0
Reply
#3

forward CloseGate(gateid, linkid, Float:fX, Float:fY, Float:fZ, Floatpeed, Float:fRotX, Float:fRotY, Float:fRotZ);

the one in red is the snake of your script look for it and make sure to array it greater than 0
Reply
#4

How to fix ?
Reply
#5

base on your script you need to make sure linkid > 0 and not < 0 which means you need to have a valid id on it.

Either you have something link this

PHP код:
for(new gategate MAX_LINKSgate++) 
that looks like this

PHP код:
for(new gate; < MAX_LINKSgate--) 
or you could just search your code for
Quote:

"CloseGate"

don't remove the "" add find what is causing the invalid id

or you can do debug 3.

Assuming you don't know debug 3
1.go to your pawno folder

2.make a new file and name it pawno.cfg

3.now edit pawno.cfg and add -d3 in it. Save it

4.Now recompile your gamemode and start again your sampserver.exe

5.send the logs here again.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)